www.digitalmars.com         C & C++   DMDScript  

digitalmars.D - Want to start a graphical Hello world.

reply MHE <send mail.de> writes:
Hi there ,  i have this code :
________________________________________________

import gtk.MainWindow, gtk.Label, gtk.Main;

class GoodbyeWorld : MainWindow {
     this() {
         super("GtkD");
         add(new Label("Goodbye World"));
         showAll();
     }
}

void main(string[] args) {
     Main.init(args);
     new GoodbyeWorld();
     Main.run();
}

________________________________________________

For this i have made a folder named GIT in the linux directory 
/usr/local/GIT
And Gitcloned in the GIT folder :
git clone https://github.com/nomad-software/x11
git clone https://github.com/nomad-software/tcltk.git
The clones are now in /usr/local/GIT/

When i start the upper code in a cmd the result is as follows :
___________________________________________________________________
$ dmd hw_graphical.d
hw_graphical.d(1): Error: module MainWindow is in file 
'gtk/MainWindow.d' which cannot be read
import path[0] = /usr/include/dmd/phobos
import path[1] = /usr/include/dmd/druntime/import


What must be done that the code make a graphical window ?

I want to make the D programming tkd module ready for GUI 
programming.
Need a step by step advice for BEGINNERS in D programming.

Any Internetlink for step by step instructions how to arrange D 
and TK would be helpful !

WBR
MHE
Jan 20 2018
next sibling parent Adam D. Ruppe <destructionator gmail.com> writes:
On Sunday, 21 January 2018 at 04:16:10 UTC, MHE wrote:
 $ dmd hw_graphical.d
You need to link in and tell the compiler where to find the library. Tru dmd -I/usr/local/GIT/whatever hw_graphical.d -L-lgtk and whatever else the library does. I haven't used gtkd so I don't know the exact thing for it, but something like that.
Jan 20 2018
prev sibling parent Matthias Klumpp <mak debian.org> writes:
On Sunday, 21 January 2018 at 04:16:10 UTC, MHE wrote:
 [...]
 For this i have made a folder named GIT in the linux directory 
 /usr/local/GIT
 And Gitcloned in the GIT folder :
 git clone https://github.com/nomad-software/x11
 git clone https://github.com/nomad-software/tcltk.git
 The clones are now in /usr/local/GIT/
Hmm, but you are using GtkD in your example... It looks like you compiled the wrong code. What you actually want is GtkD from https://github.com/gtkd-developers/GtkD or installed from the Debian repositories (in case you want to use LDC) via `sudo apt install libgtkd-3-dev`
 When i start the upper code in a cmd the result is as follows :
 ___________________________________________________________________
 $ dmd hw_graphical.d
 hw_graphical.d(1): Error: module MainWindow is in file 
 'gtk/MainWindow.d' which cannot be read
 import path[0] = /usr/include/dmd/phobos
 import path[1] = /usr/include/dmd/druntime/import


 What must be done that the code make a graphical window ?
If you want to use GtkD and achieve a quick result, you might want to use the Dub package manager. GtkD also has a few demo applications that show you how to use it with dub, take a look at https://github.com/gtkd-developers/GtkD/tree/master/demos/gtk
 I want to make the D programming tkd module ready for GUI 
 programming.
 Need a step by step advice for BEGINNERS in D programming.
tkd is a project different from GtkD (which your example above is using). For "modern" UI that integrates well with GNOME, you will highly likely want to use GtkD. Tcl/Tk is of course an option as well, but the D bindings look less complete and well maintained. In case you want to use Tk, you will need to change your code to actually use it, instead of GTK+ though ;-)
 Any Internetlink for step by step instructions how to arrange D 
 and TK would be helpful !
I can't help with Tk, but for GTK+ a quick Google search found https://sites.google.com/site/gtkdtutorial/ - this tutorial is rather old, but it might be useful as a reference. This experience report by Gerald Nunn might also be an interesting read for you: https://gexperts.com/wp/learning-d-and-gtk/ Cheers, Matthias
Jan 20 2018