[Tutor] 2 Combo Boxes! What was I thinking?

John CORRY john.corry at ntlworld.com
Sat May 6 13:23:02 CEST 2006


 
Hi,
 
I have set up a GUI which has amongst other widgets two combo boxes.  I
am using:
 
PythonCard version: 0.8.1
wxPython version: 2.6.1.0
Python version: 2.4.1 (#65, Mar 30 2005, 09:13:57) [MSC v.1310 32 bit
(Intel)]
Platform: win32
Glade 2
 
I started by setting up comboboxentry2 to accept two settings in its
drop down list.  (open + closed).  This worked fine.  Code below:
 
self.wTree = gtk.glade.XML ("phonelog.glade", "window1")
        dic={"on_window1_destroy" : self.quit, }
        self.wTree.signal_autoconnect (dic)
        
        combo1 = self.wTree.get_widget("comboboxentry2")
        
        
        combo1.append_text("Open")
        combo1.append_text("Closed")
        combo1.set_active(0)
        combo1.connect("changed", self.callback2, combo1)
        
My problems started when I went to set up comboboxentry3.  I used the
following code:
 
 
self.wTree = gtk.glade.XML ("phonelog.glade", "window1")
        dic={"on_window1_destroy" : self.quit, }
        self.wTree.signal_autoconnect (dic)
        
        
        combo3 = self.wTree.get_widget("comboboxentry3")
        combo3.connect("changed", self.callback3, "comboboxentry3")
        
        combo3.append_text ("Mon")
        combo3.append_text ("Tue")
        
        combo1 = self.wTree.get_widget("comboboxentry2")    
        combo1.append_text("Open")
        combo1.append_text("Closed")
        combo1.set_active(0)
        combo1.connect("changed", self.callback2, combo1)
            
 
  I got the following error:      
 
Gtkwarning: gtk_combo_box_append_text: assertion
GTK_IS_LIST_STORE(Combobox->Priv->Model)
Failed
Combo3.append_text("Mon")
Gtkwarning: gtk_combo_box_append_text: assertion
GTK_IS_LIST_STORE(Combobox->Priv->Model)
Failed
Combo3.append_text("Tue")
 
I then tried the code:
 
self.wTree = gtk.glade.XML ("phonelog.glade", "window1")
        dic={"on_window1_destroy" : self.quit, }
        self.wTree.signal_autoconnect (dic)
        
        
        combo3 = self.wTree.get_widget("comboboxentry3")
        combo3.connect("changed", self.callback3, "comboboxentry3")
        
        combo3.child.append_text ("Mon")
        combo3.child.append_text ("Tue")
        
        combo1 = self.wTree.get_widget("comboboxentry2")    
        combo1.append_text("Open")
        combo1.append_text("Closed")
        combo1.set_active(0)
        combo1.connect("changed", self.callback2, combo1)
 
 I get the following error message:
 
DeprecationWarning: use GtkEditable.insert_text
Combo3.child.append_text("Mon")
DeprecationWarning: use GtkEditable.insert_text
Combo3.child.append_text("Tue")
 
The combobox3 is populated on the GUI but instead of being a drop down
list it appears as a string on one line and looks like this:
MonTue
 
I have to confess I am not really sure what I am doing.  I just guessed
at putting the child command in.  It gets me close but not close enough.
Can anyone tell me what I am doing wrong or explain what happens when
you put two combo boxes on the one GUI?
 
Any help greatly appreciated.
 
Thanks,
 
John.
 
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.python.org/pipermail/tutor/attachments/20060506/db0b07de/attachment.html 


More information about the Tutor mailing list