I would like know, if is it possble to use GDK with pygtk ?
If yes, then what is the syntax to use it ? example : how to draw rectangle in window ?
Maybe this example will help you:

import pygtk
pygtk.require("2.0")
import gtk


def on_expose(da, event, *args):

    gdkwin = da.window
    gc = gdkwin.new_gc()
    gc.foreground = gdkwin.get_colormap().alloc_color("blue")
    gdkwin.draw_rectangle(gc, gtk.TRUE, 10, 10, 100, 100)


win = gtk.Window()
win.show()
win.connect("delete-event", gtk.mainquit)

da = gtk.DrawingArea()
da.show()
win.add(da)
da.connect("expose-event", on_expose)

gtk.mainloop()


When a window has to redraw itself, it emits the "expose-event".
You use the event handler to do draw into the window.
You could also use an offscreen drawable and copy the pixmap into the
window when necessary. You can force a window to redraw itself (emit
the "expose-event") by calling the window method queue_redraw().
Don't put complex drawing operations into the event handler because they
will be performed each time the window has to redraw parts.


Bye, Martin Grimme -- http://www.pycage.de

_______________________________________________
pygtk mailing list   [EMAIL PROTECTED]
http://www.daa.com.au/mailman/listinfo/pygtk
Read the PyGTK FAQ: http://www.async.com.br/faq/pygtk/

Reply via email to