473,739 Members | 3,381 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Problem with PyGTK/Glade2 ComboBox vs ComboEntryBox

Hi all. Here is a tiny container for one of each combo box, along
with the glade file. Just 2 widgets, so hopefully not too large. How
the heck do I get the selection from the ComboBox, as opposed to the
ComboEntryBox?

I'm pulling my hair out over this one!

jonathon
#!/usr/bin/env python

import sys

import pygtk; pygtk.require(' 2.0')
import gtk
import gtk.glade

class tinytest:
def __init__(self):
gladefile = 'project4.glade '
windowname = 'window1'
self.wTree = gtk.glade.XML(g ladefile, windowname)

dic = { 'on_window1_des troy' : (gtk.mainquit),
'on_comboboxent ry1_changed' : self.cbe,
'on_combobox1_c hanged' : self.cb
}
self.wTree.sign al_autoconnect( dic)

def cbe(self, widget):
s = self.wTree.get_ widget('combobo xentry1').get_c hildren()[0].get_text()
print 'cbe changed %s' % s

def cb(self, widget):
# s = self.wTree.get_ widget('combobo x1').entry.get_ text()
# print 'cb changed %s' % s
s = self.wTree.get_ widget('combobo x1').get_childr en()[0].list
s = self.wTree.get_ widget('combobo x1').list.get()
print 'cb changed %s' % s
s = self.wTree.get_ widget('combobo x1').active
print 'cb changed %d' % s

tinytest()
gtk.main()
<?xml version="1.0" standalone="no" ?> <!--*- mode: xml -*-->
<!DOCTYPE glade-interface SYSTEM
"http://glade.gnome.org/glade-2.0.dtd">

<glade-interface>

<widget class="GtkWindo w" id="window1">
<property name="visible"> True</property>
<property name="title" translatable="y es">window1</property>
<property name="type">GTK _WINDOW_TOPLEVE L</property>
<property name="window_po sition">GTK_WIN _POS_NONE</property>
<property name="modal">Fa lse</property>
<property name="resizable ">True</property>
<property name="destroy_w ith_parent">Fal se</property>
<property name="decorated ">True</property>
<property name="skip_task bar_hint">False </property>
<property name="skip_page r_hint">False</property>
<property name="type_hint ">GDK_WINDOW_TY PE_HINT_NORMAL</property>
<property name="gravity"> GDK_GRAVITY_NOR TH_WEST</property>
<signal name="destroy" handler="on_win dow1_destroy"
last_modificati on_time="Fri, 21 May 2004 1\1:31:03 GMT"/>

<child>
<widget class="GtkVBox" id="vbox1">
<property name="visible"> True</property>
<property name="homogeneo us">False</property>
<property name="spacing"> 0</property>

<child>
<widget class="GtkCombo BoxEntry" id="comboboxent ry1">
<property name="visible"> True</property>
<property name="items" translatable="y es">Entry 1
Entry 2
Entry 3</property>
<signal name="changed" handler="on_com boboxentry1_cha nged"
last_modificati on_time="Fri\, 21 May 2004 10:28:23 GMT"/>
</widget>
<packing>
<property name="padding"> 0</property>
<property name="expand">T rue</property>
<property name="fill">Tru e</property>
</packing>
</child>

<child>
<widget class="GtkCombo Box" id="combobox1" >
<property name="visible"> True</property>
<property name="items" translatable="y es">Item 1
Item 2
Item 3</property>
<signal name="changed" handler="on_com bobox1_changed"
last_modificati on_time="Fri, 21 \May 2004 10:28:35 GMT"/>
</widget>
<packing>
<property name="padding"> 0</property>
<property name="expand">T rue</property>
<property name="fill">Tru e</property>
</packing>
</child>
</widget>
</child>
</widget>

</glade-interface>
Jul 18 '05 #1
4 2600
P
j_mckitrick wrote:
Hi all. Here is a tiny container for one of each combo box, along
with the glade file. Just 2 widgets, so hopefully not too large. How
the heck do I get the selection from the ComboBox, as opposed to the
ComboEntryBox?

I'm pulling my hair out over this one!


Ah this has changed in gtk 2.4
http://developer.gnome.org/doc/API/2...kComboBox.html
The docs on pygtk.org are out of date, mutter...
Are you sure (your) pygtk supports the newer model?

Pádraig.
Jul 18 '05 #2
> Ah this has changed in gtk 2.4
http://developer.gnome.org/doc/API/2...kComboBox.html
The docs on pygtk.org are out of date, mutter...
Are you sure (your) pygtk supports the newer model?


I have no idea. I have what I believe to be the latest pygtk - 2.2.0.

This has been frustrating me for a while. Is there a workaround?
Jul 18 '05 #3
On Sat, 22 May 2004 14:32:59 -0700, j_mckitrick wrote:
Ah this has changed in gtk 2.4
http://developer.gnome.org/doc/API/2...kComboBox.html
The docs on pygtk.org are out of date, mutter...
Are you sure (your) pygtk supports the newer model?


I have no idea. I have what I believe to be the latest pygtk - 2.2.0.

This has been frustrating me for a while. Is there a workaround?


Your version of pygtk does not cover gtk-2.4 changes.
You have the latest stable.

There is a beta which support new widgets. The last (of yesterday), is
pygtk-2.3.92
You can find it at
http://ftp.gnome.org/pub/gnome/sources/pygtk/2.3/

Ciao,
Riccardo

--
-=Riccardo Galli=-

_,e.
s~ ``
~@. ideralis Programs
.. ol
`**~ http://www.sideralis.net
Jul 18 '05 #4
Thank you both!

I have the latest pygtk AND used the docs to get the combo box
working. Thanks again!

jonathon
Jul 18 '05 #5

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

Similar topics

0
1379
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 'Glade' to help build these gui. I downloaded the pyGTK tarball from http://www.daa.com.au/~james/software/pygtk/ i do the usual ./configure, make, makeinstall.
4
1624
by: j_mckitrick | last post by:
I am having a problem with combo boxes. If I am using an XML glade2 file for my gui definition, what is the command I need to use to access a given combo box and determine the currently selected item? jonathon
6
2038
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 errors but the process finishes so I assumed they weren't fatal errors. So now I attempt to run my python program and I get; $ gccp.py Traceback (most recent call last):
2
2575
by: Friedrich Dimmling | last post by:
Hi, I would like to use pango.layout to display text in a pygtk2 project. However I could not manage to get the pango.layout object incorporated in my toplevel gtk.Window and have it displayed. If anyone could help me either with a minimal example like 'Hello World' displayed in italics in an pango.layout or the URL to a tutorial where I can find the relevant infos (the PyGtk tutorial seems not to contain it, unless I'm really blind)
2
3355
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 progressbar and ListStore: basically i need to make pulse the progressbar while i'm copying files and write filenames copied on the ListStore on to the window.
1
1473
by: Thomas Bartkus | last post by:
I am experimenting (flailing around?) with glade and python. Both under MS Windows and Linux. I understand why I want to "import gtk" It gives me access to the critical gui program loop gtk.main() and main_quit() I am also very grateful for import gtk.glade This lets me open my xml format glade file
25
4280
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 on Windows "(...) > can i use pyGTK under > Windows???
1
2481
by: kristian.hermansen | last post by:
keherman@ibmlnx20:/tmp$ cat helloworld.py #!/usr/bin/env python import pygtk pygtk.require('2.0')
2
6101
by: =?ISO-8859-15?Q?Ma=EBl_Benjamin_Mettler?= | last post by:
Hello list! I need to repopulate PyGTK ComboBox on a regular basis. In order to do so I have to remove all the entries and then add the new ones. I tried to remove all entries like that: def clear_comboboxes(boxreference): try: while True: boxreference.remove_text(0)
0
8794
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
9341
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
9211
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
8216
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
6756
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6056
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4572
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
1
3282
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
2748
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.