How do you draw in gtkD? Simple example overriding Widget.draw() doesn't compile.
Enjoys Math via Digitalmars-d-learn
digitalmars-d-learn at puremagic.com
Tue Jan 26 18:06:07 PST 2016
On Wednesday, 27 January 2016 at 01:54:53 UTC, Enjoys Math wrote:
> import gtk.MainWindow;
> import gtk.Main;
> import gtk.DrawingArea;
> import cairo.Context;
> import std.stdio;
>
> void main(string[] args) {
> Main.init(args);
> auto win = new MainWindow("Hello World");
> win.setDefaultSize(200, 100);
> win.add(new MyDrawingArea());
> win.showAll();
> Main.run();
> }
>
> class MyDrawingArea : DrawingArea {
> override bool draw(Context cairo) {
> writeln("Hello");
> return true;
> }
> }
>
> Error:
> Error: function main.MyDrawingArea.draw does not override any
> function, did you mean to override 'gtk.Widget.Widget.draw'?
Oh i see, there are examples under the GDk directory under
'demos'.
More information about the Digitalmars-d-learn
mailing list