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

Problem with PyGTK/Glade2 ComboBox vs ComboEntryBox

P: n/a
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(gladefile, windowname)

dic = { 'on_window1_destroy' : (gtk.mainquit),
'on_comboboxentry1_changed' : self.cbe,
'on_combobox1_changed' : self.cb
}
self.wTree.signal_autoconnect(dic)

def cbe(self, widget):
s = self.wTree.get_widget('comboboxentry1').get_childr en()[0].get_text()
print 'cbe changed %s' % s

def cb(self, widget):
# s = self.wTree.get_widget('combobox1').entry.get_text( )
# print 'cb changed %s' % s
s = self.wTree.get_widget('combobox1').get_children()[0].list
s = self.wTree.get_widget('combobox1').list.get()
print 'cb changed %s' % s
s = self.wTree.get_widget('combobox1').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="GtkWindow" id="window1">
<property name="visible">True</property>
<property name="title" translatable="yes">window1</property>
<property name="type">GTK_WINDOW_TOPLEVEL</property>
<property name="window_position">GTK_WIN_POS_NONE</property>
<property name="modal">False</property>
<property name="resizable">True</property>
<property name="destroy_with_parent">False</property>
<property name="decorated">True</property>
<property name="skip_taskbar_hint">False</property>
<property name="skip_pager_hint">False</property>
<property name="type_hint">GDK_WINDOW_TYPE_HINT_NORMAL</property>
<property name="gravity">GDK_GRAVITY_NORTH_WEST</property>
<signal name="destroy" handler="on_window1_destroy"
last_modification_time="Fri, 21 May 2004 1\1:31:03 GMT"/>

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

<child>
<widget class="GtkComboBoxEntry" id="comboboxentry1">
<property name="visible">True</property>
<property name="items" translatable="yes">Entry 1
Entry 2
Entry 3</property>
<signal name="changed" handler="on_comboboxentry1_changed"
last_modification_time="Fri\, 21 May 2004 10:28:23 GMT"/>
</widget>
<packing>
<property name="padding">0</property>
<property name="expand">True</property>
<property name="fill">True</property>
</packing>
</child>

<child>
<widget class="GtkComboBox" id="combobox1">
<property name="visible">True</property>
<property name="items" translatable="yes">Item 1
Item 2
Item 3</property>
<signal name="changed" handler="on_combobox1_changed"
last_modification_time="Fri, 21 \May 2004 10:28:35 GMT"/>
</widget>
<packing>
<property name="padding">0</property>
<property name="expand">True</property>
<property name="fill">True</property>
</packing>
</child>
</widget>
</child>
</widget>

</glade-interface>
Jul 18 '05 #1
Share this Question
Share on Google+
4 Replies


P: n/a
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

P: n/a
> 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

P: n/a
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

P: n/a
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 discussion thread is closed

Replies have been disabled for this discussion.