[wxPython] wxFrame don't have Bind attribute ??

Discussion in 'Python' started by Jia Lu, Oct 30, 2006.

  1. Jia Lu

    Jia Lu Guest

    Hi all
    I am using wxPy 2.6.3.2-2, But when run an application with self.Bind
    , I got an error that there is no Bind.

    How can I fix it. thanx
    Jia Lu, Oct 30, 2006
    #1
    1. Advertising

  2. Jia Lu

    Steve Holden Guest

    Jia Lu wrote:
    > Hi all
    > I am using wxPy 2.6.3.2-2, But when run an application with self.Bind
    > , I got an error that there is no Bind.
    >
    > How can I fix it. thanx
    >

    Perhaps you could show us the code that's failing, with the traceback -
    even better, use the knowledge you have already gained to write a
    *short* program that exhibits the same failure. Then post the code and
    the traceback.

    regards
    Steve
    --
    Steve Holden +44 150 684 7255 +1 800 494 3119
    Holden Web LLC/Ltd http://www.holdenweb.com
    Skype: holdenweb http://holdenweb.blogspot.com
    Recent Ramblings http://del.icio.us/steve.holden
    Steve Holden, Oct 30, 2006
    #2
    1. Advertising

  3. Re: wxFrame don't have Bind attribute ??

    Jia Lu schreef:

    > Hi all
    > I am using wxPy 2.6.3.2-2, But when run an application with self.Bind
    > , I got an error that there is no Bind.
    >
    > How can I fix it. thanx


    You can not bind an event to a wx application. You must bind an event
    to a wx frame or control. You'll get more and better support on the
    wxpython-user mailing list.

    Stani

    --
    http://pythonide.stani.be
    SPE - Stani's Python Editor, Oct 30, 2006
    #3
  4. Jia Lu

    Jia Lu Guest

    Re: wxFrame don't have Bind attribute ??

    Steve Holden ã®ãƒ¡ãƒƒã‚»ãƒ¼ã‚¸:
    > Perhaps you could show us the code that's failing,


    the code is :

    <code>
    #!/usr/bin/python -tt

    __author__ = "Jia Lu <>"
    __verstion__ = "1.0.0"

    import wx

    class MyFrame(wx.Frame):
    def __init__(self):
    wx.Frame.__init__(self, None, -1, "MyFrame", size=(300,300))
    panel = wx.Panel(self, -1)
    panel.Bind(wx.EVT_MOTION, self.OnMove)
    wx.StaticText(panel, -1, "Pos:", pos=(100,105))
    self.posCtrl = wx.TextCtrl(panel, -1, "", pos=(130,100))

    def OnMove(self, event):
    pos = event.GetPosition()
    self.posCtrl.SetValue("%s, %s" % (pos.x, pos.y))

    if __name__ == "__main__":
    app = wx.PySimpleApp()
    frame = MyFrame()
    frame.Show(True)
    app.MainLoop()
    Jia Lu, Oct 30, 2006
    #4
  5. Re: wxFrame don't have Bind attribute ??

    Jia Lu wrote:
    > Steve Holden ã®ãƒ¡ãƒƒã‚»ãƒ¼ã‚¸:
    > > Perhaps you could show us the code that's failing,

    >
    > the code is :
    >
    > <code>
    > #!/usr/bin/python -tt
    >
    > __author__ = "Jia Lu <>"
    > __verstion__ = "1.0.0"
    >
    > import wx
    >
    > class MyFrame(wx.Frame):
    > def __init__(self):
    > wx.Frame.__init__(self, None, -1, "MyFrame", size=(300,300))
    > panel = wx.Panel(self, -1)
    > panel.Bind(wx.EVT_MOTION, self.OnMove)
    > wx.StaticText(panel, -1, "Pos:", pos=(100,105))
    > self.posCtrl = wx.TextCtrl(panel, -1, "", pos=(130,100))
    >
    > def OnMove(self, event):
    > pos = event.GetPosition()
    > self.posCtrl.SetValue("%s, %s" % (pos.x, pos.y))
    >
    > if __name__ == "__main__":
    > app = wx.PySimpleApp()
    > frame = MyFrame()
    > frame.Show(True)
    > app.MainLoop()


    This works perfectly for me, using wxPython 2.6.3.2, on both Linux and
    Windows.

    What platform are you using?

    Frank Millman
    Frank Millman, Oct 30, 2006
    #5
  6. Jia Lu

    Jia Lu Guest

    Re: wxFrame don't have Bind attribute ??

    Frank Millman ã®ãƒ¡ãƒƒã‚»ãƒ¼ã‚¸:
    > This works perfectly for me, using wxPython 2.6.3.2, on both Linux and
    > Windows.
    >
    > What platform are you using?

    Yes this works OK for me too on my FedoraCore 5, but cannot work on my
    FedoraCore 6...
    Jia Lu, Oct 30, 2006
    #6
  7. Re: wxFrame don't have Bind attribute ??

    Jia Lu wrote:
    > Frank Millman ã®ãƒ¡ãƒƒã‚»ãƒ¼ã‚¸:
    > > This works perfectly for me, using wxPython 2.6.3.2, on both Linux and
    > > Windows.
    > >
    > > What platform are you using?

    > Yes this works OK for me too on my FedoraCore 5, but cannot work on my
    > FedoraCore 6...


    Then it is probably an installation problem, which I doubt if I can
    help with. However, if you can answer the following questions, someone
    else may be able to assist -

    1. What is the exact error message?

    2. Which version of wxPython are you using?

    3. How did you install wxPython - by compiling from source, or by
    installing an rpm? I don't think there are any FC6 rpm's available yet.

    If you don't get an answer here, ask on the wxPython mailing list -


    Frank
    Frank Millman, Oct 30, 2006
    #7
  8. On 29 Oct 2006 22:31:09 -0800, "Jia Lu" <> wrote:

    >Hi all
    > I am using wxPy 2.6.3.2-2, But when run an application with self.Bind
    >, I got an error that there is no Bind.
    >
    > How can I fix it. thanx


    Is it really an instance of wx.Frame?
    What do you get, if you make a "print self" statement?
    Franz Steinhaeusler, Nov 17, 2006
    #8
  9. Jia Lu

    Jia Lu Guest

    Re: wxFrame don't have Bind attribute ??

    Franz Steinhaeusler wrote:
    > Is it really an instance of wx.Frame?
    > What do you get, if you make a "print self" statement?

    sovled it
    I think it is an installation problem.
    I used yum on FC6 to install wxPython 2.6
    But after that I got that error.

    Now I uninstalled them and did an installation of wxPy 2.7 manully.
    It is ok now..
    Jia Lu, Nov 17, 2006
    #9
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Mirko Koenig
    Replies:
    4
    Views:
    814
    Mirko Koenig
    Aug 27, 2003
  2. Piet
    Replies:
    1
    Views:
    591
  3. Austin

    How to set the size of wxFrame

    Austin, Oct 28, 2004, in forum: Python
    Replies:
    1
    Views:
    427
    Sion Arrowsmith
    Oct 28, 2004
  4. Alex VanderWoude
    Replies:
    2
    Views:
    824
    Alex VanderWoude
    Mar 25, 2005
  5. CYBER
    Replies:
    2
    Views:
    674
    Ed Leafe
    May 3, 2005
Loading...

Share This Page