[Tutor] WXPython Listbox Problem

Jorgen Bodde jorgen.maillist at gmail.com
Wed Dec 6 19:28:15 CET 2006


Try ID's higher then 10000 ... low ID's are usually taken by
wxWidgets. To be safe simply create them with wx.ID_ANY (from the top
of my head) and after that:

self.box1.Bind(wx.EVT_LISTBOX, self.b1func,id=self.box1.GetId())

Which is a bit more dynamic anyway and saves you some constants.

Furthermore, wxPython specific questions could be better answered in
the wxPython-users mailinglist to get more succes ;-)

Regards,
- Jorgen


On 12/6/06, Toon Pieton <pytutmail at gmail.com> wrote:
> Hey friendly users!
>
> I'm trying to make a simple program to calculate the odds when playing
> poker. The idea is that you select both your cards from listboxes. However,
> no matter what I try, I just can't select a entry in either of the
> listboxes! I can click all I want, it just won't select. Here's the code
> which I use to create the boxes:
>
> ID_BOX1 = 120
> ID_BOX2 = 130
> ...
>         #Boxes, to select cards
>          self.box1 = wx.ListBox(parent=self, id=ID_BOX1, size=(60,163) ,
> name='Card 1',
>
> choices=['Ace','King','Queen','Ten','9','8','7','6','5','4','3','2'],style=0)
>         self.box2 = wx.ListBox(parent=self, id=ID_BOX2, size=(60,163) ,
> name='Card 2',
>
> choices=['Ace','King','Queen','Ten','9','8','7','6','5','4','3','2'],style=0)
>          self.box1.Bind(wx.EVT_LISTBOX, self.b1func,id=ID_BOX1)
>         self.box2.Bind(wx.EVT_LISTBOX, self.b2func,id=ID_BOX2)
>
> I hope anybody can help me. If you need to see the full code, just send me a
> reply
>
> Thanks in advance to anybody reading/helping!
> Toon Pieton
>
> _______________________________________________
> Tutor maillist  -  Tutor at python.org
> http://mail.python.org/mailman/listinfo/tutor
>
>
>


On 12/6/06, Toon Pieton <pytutmail at gmail.com> wrote:
> Hey friendly users!
>
> I'm trying to make a simple program to calculate the odds when playing
> poker. The idea is that you select both your cards from listboxes. However,
> no matter what I try, I just can't select a entry in either of the
> listboxes! I can click all I want, it just won't select. Here's the code
> which I use to create the boxes:
>
> ID_BOX1 = 120
> ID_BOX2 = 130
> ...
>         #Boxes, to select cards
>          self.box1 = wx.ListBox(parent=self, id=ID_BOX1, size=(60,163) ,
> name='Card 1',
>
> choices=['Ace','King','Queen','Ten','9','8','7','6','5','4','3','2'],style=0)
>         self.box2 = wx.ListBox(parent=self, id=ID_BOX2, size=(60,163) ,
> name='Card 2',
>
> choices=['Ace','King','Queen','Ten','9','8','7','6','5','4','3','2'],style=0)
>          self.box1.Bind(wx.EVT_LISTBOX, self.b1func,id=ID_BOX1)
>         self.box2.Bind(wx.EVT_LISTBOX, self.b2func,id=ID_BOX2)
>
> I hope anybody can help me. If you need to see the full code, just send me a
> reply
>
> Thanks in advance to anybody reading/helping!
> Toon Pieton
>
> _______________________________________________
> Tutor maillist  -  Tutor at python.org
> http://mail.python.org/mailman/listinfo/tutor
>
>
>


More information about the Tutor mailing list