[x-posted to PyGTk mailing list as well]
Hello!
I'm trying to figure out how to use PYGTK to implement a rudimentary UI:
I want to have an Image as the background, and then be able to put buttons
(eventually icons, but buttons for now)
The PyGTK FAQ (pygtk.org) has some suggestions, but they have failed
to clear up the issue. Using their suggestions as a starting point,
I've arrived at the below. However, it fails in that I can't seem to
place the image behind the button. There is a FAQ entry specifically
on this at PyGTK.org, but that fails to show the pixmap (it is
obscured completely when we place a button in the Fixed widget), and
fails to allow the pixmap to be scrolled.
Can anyone show a minimal example of how I might achieve having the pixmap
as the background of the Fixed widget?
Thanks
Johan
def __init__(self):
# create the main window, and attach delete_event signal to terminating
# the application
window = gtk.Window(gtk. WINDOW_TOPLEVEL )
window.connect( "delete_eve nt", self.close_appl ication)
window.connect( "destroy", self.close_appl ication)
window.set_bord er_width(0)
hbox= gtk.HBox()
window.add(hbox )
hbox.show()
swin1 = gtk.ScrolledWin dow()
swin1.set_polic y(gtk.POLICY_AL WAYS, gtk.POLICY_ALWA YS)
swin1.set_size_ request(600, 600)
hbox.add(swin1)
swin1.show()
fbox1 = gtk.Fixed()
swin1.add_with_ viewport(fbox1)
fbox1.show()
ebox1 = gtk.EventBox()
fbox1.put(ebox1 ,0,0)
ebox1.show()
image1 = gtk.Image()
image1.set_from _file("/home/johan/bg.jpg")
ebox1.add(image 1)
image1.show()
widgetinfo( image1)
b = gtk.Button("FOO ")
fbox1.put(b, 200,200)
b.show()
widgetinfo(b)
ebox1.set_event s(gtk.gdk.BUTTO N_PRESS_MASK)
ebox1.connect(" button_press_ev ent", self.button_cli cked)
window.show()
Hello!
I'm trying to figure out how to use PYGTK to implement a rudimentary UI:
I want to have an Image as the background, and then be able to put buttons
(eventually icons, but buttons for now)
The PyGTK FAQ (pygtk.org) has some suggestions, but they have failed
to clear up the issue. Using their suggestions as a starting point,
I've arrived at the below. However, it fails in that I can't seem to
place the image behind the button. There is a FAQ entry specifically
on this at PyGTK.org, but that fails to show the pixmap (it is
obscured completely when we place a button in the Fixed widget), and
fails to allow the pixmap to be scrolled.
Can anyone show a minimal example of how I might achieve having the pixmap
as the background of the Fixed widget?
Thanks
Johan
def __init__(self):
# create the main window, and attach delete_event signal to terminating
# the application
window = gtk.Window(gtk. WINDOW_TOPLEVEL )
window.connect( "delete_eve nt", self.close_appl ication)
window.connect( "destroy", self.close_appl ication)
window.set_bord er_width(0)
hbox= gtk.HBox()
window.add(hbox )
hbox.show()
swin1 = gtk.ScrolledWin dow()
swin1.set_polic y(gtk.POLICY_AL WAYS, gtk.POLICY_ALWA YS)
swin1.set_size_ request(600, 600)
hbox.add(swin1)
swin1.show()
fbox1 = gtk.Fixed()
swin1.add_with_ viewport(fbox1)
fbox1.show()
ebox1 = gtk.EventBox()
fbox1.put(ebox1 ,0,0)
ebox1.show()
image1 = gtk.Image()
image1.set_from _file("/home/johan/bg.jpg")
ebox1.add(image 1)
image1.show()
widgetinfo( image1)
b = gtk.Button("FOO ")
fbox1.put(b, 200,200)
b.show()
widgetinfo(b)
ebox1.set_event s(gtk.gdk.BUTTO N_PRESS_MASK)
ebox1.connect(" button_press_ev ent", self.button_cli cked)
window.show()