Spawn a Command Line application Window and output log information

Adam D. Ruppe destructionator at gmail.com
Mon May 18 17:36:53 UTC 2020


On Monday, 18 May 2020 at 16:36:11 UTC, BoQsc wrote:
> Would this require GUI library and how can this be achieved?

you might enjoy using my terminal lib

https://code.dlang.org/packages/arsd-official%3Aterminal

include that and set

"subConfigurations": {
    "arsd-official:terminal": "builtin_emulator"
}


and it gives you a gui window that acts like a terminal.

then in your program, here's a complete program you can run with

dub run --single file.d


/+ dub.sdl:
         name "cool"
         dependency "arsd-official:terminal" version=">=7.2.0"
         subConfiguration "arsd-official:terminal" 
"builtin_emulator"
+/

import arsd.terminal;
void main() {
    auto terminal = Terminal(ConsoleOutputType.linear);
    terminal.setTitle("whatever");

    // this is possible too but you MUST have an indexed png which 
might be hard to make if you aren't ready for it.
    terminal.changeWindowIcon("your_icon.png");

    terminal.writeln("hi");

    auto got = terminal.getline("say something: ");

    terminal.writeln("you said ", got);
}


More information about the Digitalmars-d-learn mailing list