473,396 Members | 1,853 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

pygtk help

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

hbox= gtk.HBox()
window.add(hbox)
hbox.show()

swin1 = gtk.ScrolledWindow()
swin1.set_policy(gtk.POLICY_ALWAYS, gtk.POLICY_ALWAYS)
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(image1)
image1.show()
widgetinfo( image1)

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

ebox1.set_events(gtk.gdk.BUTTON_PRESS_MASK)
ebox1.connect("button_press_event", self.button_clicked)

window.show()

Jul 18 '05 #1
0 1315

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
by: zinc | last post by:
Hi Pythoneers, Im interested in trying some gui programming with the GTK2 toolkit. I found this brief article,(http://www.linuxjournal.com/article.php?sid=6586), that speaks about utilising...
6
by: Mark Mitchell | last post by:
-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 I have a program written in python that tells me it requires PyGTK, so I DLed, ./configure, make, make install and the process seems to go ok. Some...
2
by: Samuele Giovanni Tonon | last post by:
hi, i'm trying to develop a trivial application which random copy files from a directory to another one. i made it using pygtk for the graphical interface, however i find some problem with...
22
by: dcrespo | last post by:
Hi all... I think wxPython is much better than PyGTK. First of all, PyGTK needs the GTK runtime installed, whereas wxPython is entirely Python's modules, so It facilitates the apps'...
25
by: TPJ | last post by:
GUI's etc: PyGtk on Windows "(...) So if someone develops mainly for X and just wants to make sure that it is not impossible to run on Windows, you can use PyGTK. (...)", July 2nd, 1999 pyGTK...
2
by: Tim N. van der Leeuw | last post by:
I tried to create a windows executable of a pygtk program. My first attempt worked, kinda, except that no themes were applied and no readable fonts were found by pango; so all letters where just...
1
by: krishnakant Mane | last post by:
hello, I will be writing some code in PyGTK to run on linux. but I want to know if there are any installers or distutils available for PyGTK on windows? I have heard that installing gimp or even...
0
by: He Jibo | last post by:
Hi, Everyone, Could someone help me how to install pygtk? I get some problems with it. Here is the error I get while install pygtk: https://netfiles.uiuc.edu/jibohe2/error.GIF?uniq=-k6678k ...
0
by: Michael Palmer | last post by:
On Sep 16, 12:30 pm, binaryjesus <coolman.gu...@gmail.comwrote: I haven't tried it myself, but I came across a blog post the other day that describes a way of building windows installers for...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.