Python Forum
[WxPython] Bind error
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
[WxPython] Bind error
#1
With Python2 I have this little script with an error in the line with "******" stars:
#!/usr/bin/python

import wx

def quit():
	print("Quit\n")

app = wx.App() 
w = wx.Frame(None) 
menuQuit = wx.Menu("Quit")
menuBar = wx.MenuBar()
menuBar.Append(menuQuit, "Operations")
w.SetMenuBar(menuBar)
w.Bind(wx.EVT_MENU, quit, menuQuit) #******This produces an error*****
w.Show(True) 

app.MainLoop()
This is the error message:
Error:
Traceback (most recent call last): File "./test.py", line 14, in <module> w.Bind(wx.EVT_MENU, quit, menuQuit) #******This produces an error***** File "/home/peter/.local/lib/python2.7/site-packages/wx/core.py", line 1403, in _EvtHandler_Bind assert source is None or hasattr(source, 'GetId')
What am I doing wrong?

Greetings
Peter
Reply
#2
check out this link ecent handling wx The best information on wx python comes from a book with detailed explanations and code I liked wx python in action wx python in action
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  [Tkinter] bind menator01 1 1,234 Apr-15-2022, 08:47 PM
Last Post: menator01
  [Tkinter] bind lambda keypress counter knoxvilles_joker 15 7,627 Apr-19-2021, 01:56 AM
Last Post: knoxvilles_joker
  [Tkinter] Mouse click without use bind ATARI_LIVE 8 7,261 Oct-23-2020, 10:41 PM
Last Post: ATARI_LIVE
  [Kivy] AttributeError: 'NoneType' object has no attribute 'bind' faszination_92 2 6,191 Apr-12-2020, 07:01 PM
Last Post: Larz60+
  Tkinter:Unable to bind and unbind function with a button shallanq 2 4,968 Mar-28-2020, 02:05 AM
Last Post: joe_momma
  [Tkinter] How to bind an event when enter is pressed on a Entry control? Michael4 4 3,881 Aug-29-2019, 10:11 PM
Last Post: Michael4
  Update plot by <Return> bind with entry widget Zorro 1 4,091 Mar-09-2019, 12:27 PM
Last Post: Zorro
  Bind only fires off once? WuchaDoin 3 4,427 Dec-18-2018, 07:46 PM
Last Post: buran
  [WxPython] bind label and entry text with return key metulburr 1 3,215 Aug-14-2018, 10:02 PM
Last Post: metulburr
  [Tkinter] Is there any way to bind keys to a gui window in tkinter? Nwb 1 3,135 Jun-21-2018, 06:04 PM
Last Post: Larz60+

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020