[Tutor] 2 Combo Boxes! What was I thinking?
Kent Johnson
kent37 at tds.net
Sat May 6 14:19:36 CEST 2006
John CORRY wrote:
> 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
From your code it looks like you are using pyGTK and Glade, not
PythonCard and wxPython. I don't have the answer to your question but it
might help to get the question right :-)
Kent
>
>
>
> 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.
>
>
>
>
> ------------------------------------------------------------------------
>
> _______________________________________________
> Tutor maillist - Tutor at python.org
> http://mail.python.org/mailman/listinfo/tutor
More information about the Tutor
mailing list