discuss-gnuradio
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Discuss-gnuradio] WX Problem


From: Eric Blossom
Subject: Re: [Discuss-gnuradio] WX Problem
Date: Wed, 22 Apr 2009 10:53:20 -0700
User-agent: Mutt/1.5.18 (2008-05-17)

On Wed, Apr 22, 2009 at 10:54:12AM -0400, Matthew Dolloff wrote:
> I'm having a problem creating a GUI.  I'm trying to bind an event to a
> button but when i bind the event, the callback is called immediately.
> I'm not sure what the heck is happening.  Any help would be greatly
> appreciated.  if you look at the code below you can see that the
> callback is getting called immediately.
> 
> #Code Snippet
> 
>     def _create_Gui (self, vbox):
>         self.myform = myform = form.form()
> 
>         hbox = wx.BoxSizer(wx.HORIZONTAL)
>         hbox.Add((5,0),0)
> 
>         self.b1 = wx.ToggleButton(self.panel,wx.ID_ANY,"button 1")
>         print "1"
>         self.b1.Bind(wx.EVT_LEFT_DCLICK, self._setText())

self.setText() is a call, that's why it's getting called right away.
Try self.setText [no parens].

>         print "2"
>         hbox.Add(self.b1,1,wx.LEFT | wx.RIGHT ,2)
> 
>         self.b2 = wx.Button(self.panel,wx.ID_ANY,"button 2")
>         hbox.Add(self.b2,1,wx.LEFT | wx.RIGHT ,2)
>         vbox.Add(hbox, 0, wx.EXPAND)
>         return
> 
>     def _setText(self):
>         print "button pressed"
>         self.b1.Show(False)
>         return
> 
> # Terminal Window Output
> 1
> button pressed
> 2
> 
> 
> _______________________________________________
> Discuss-gnuradio mailing list
> address@hidden
> http://lists.gnu.org/mailman/listinfo/discuss-gnuradio
> 




reply via email to

[Prev in Thread] Current Thread [Next in Thread]