I'm trying to write a presentation graphics thingy.  I need to be able
to create an undecorated window the size of the full screen and stick a
gnomecanvas in it.  I've found _create_window with the
'override_redirect' option, but I can't get the canvas to show up.  The
code I've got so far is:

---------------

from gtk import *
from gnome.ui import *
import GDK
from gtk import _root_window, _window_new

rw = _root_window()
w = rw.width
h = rw.height

c = GnomeCanvas()
cm = c.get_colormap()
c.connect('button_press_event', mainquit)
c.set_usize(w/2, h/2)
c.set_scroll_region(0,0,w/2,h/2)
win = _window_new(None, {'window_type' : GDK.WINDOW_TOPLEVEL,
                         'event_mask' : GDK.ALL_EVENTS_MASK,
                         'width' : w/2, 'height' : h/2,
                         'wmclass' : GDK.INPUT_OUTPUT,
                         'x' : 0, 'y' : 0, 'colormap' : cm,
                         'override_redirect' : 1})
c.set_parent_window(win)
root = c.root()
i = root.add('rect', x1=5, y1=5, x2=450, y2=400,
fill_color=cm.alloc("blue"))
i.show()
i.raise_to_top()
i.move(15, 15)
c.show_all()
win.show()

mainloop()

-----------

With this code I get a black rectangle in the upper left hand corner of
the screen (I'm only doing half the screen now so I can get to an xterm
and kill the app).  The rectangle obeys override_redirect; if it is true
-> no decorations or WM control, if not I get a titlebar and can move
the window.  Confusingly (to me at least), omitting the
c.set_parent_window command seems to have no effect; I get the black
rectangle (with or without a title per override_redirect) whether it is
there or not.

Any explanations, suggestions, or ideas would be appreciated.

Jay

_______________________________________________
pygtk mailing list   [EMAIL PROTECTED]
http://www.daa.com.au/mailman/listinfo/pygtk

Reply via email to