By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
444,199 Members | 1,125 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 444,199 IT Pros & Developers. It's quick & easy.

pygtk help

P: n/a
[x-posted to PyGTk mailing list as well]


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 ( 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, 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?



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_event", self.close_application)
window.connect("destroy", self.close_application)

hbox= gtk.HBox()

swin1 = gtk.ScrolledWindow()
swin1.set_policy(gtk.POLICY_ALWAYS, gtk.POLICY_ALWAYS)
swin1.set_size_request(600, 600)

fbox1 = gtk.Fixed()

ebox1 = gtk.EventBox()

image1 = gtk.Image()
widgetinfo( image1)

b = gtk.Button("FOO")
fbox1.put(b, 200,200)

ebox1.connect("button_press_event", self.button_clicked)

Jul 18 '05 #1
Share this question for a faster answer!
Share on Google+

This discussion thread is closed

Replies have been disabled for this discussion.