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

J

Jia Lu

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
 
S

Steve Holden

Jia said:
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
 
S

SPE - Stani's Python Editor

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
 
J

Jia Lu

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

the code is :

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

__author__ = "Jia Lu <[email protected]>"
__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()
 
F

Frank Millman

Jia said:
Steve Holden ã®ãƒ¡ãƒƒã‚»ãƒ¼ã‚¸:

the code is :

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

__author__ = "Jia Lu <[email protected]>"
__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
 
J

Jia Lu

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...
 
F

Frank Millman

Jia said:
Frank Millman ã®ãƒ¡ãƒƒã‚»ãƒ¼ã‚¸:
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 -
(e-mail address removed)

Frank
 
F

Franz Steinhaeusler

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?
 
J

Jia Lu

Franz said:
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..
 

Ask a Question

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

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,755
Messages
2,569,536
Members
45,013
Latest member
KatriceSwa

Latest Threads

Top