python - Tkinter Error on keypress -
code:
import tkinter window = tkinter.tk() c = tkinter.canvas(window, height=400, width=600, bg='green') mid_x = 600 / 2 mid_y = 400 / 2 window.geometry("600x400") window.title("window")  def ship_control(event):     pass  c.bind_all('<keypress-a>', ship_control) def start():     global ship     rock_speed = 10     ship = c.create_oval(mid_x, mid_y, mid_x + 20, mid_y + 20, fill='red', outline='orange')  button_start = tkinter.button(window, text='play', command=start) button_start.pack() c.pack() error:
>>>  >>> exception in tkinter callback traceback (most recent call last):   file "c:\program files\python 3.5\lib\idlelib\run.py", line 121, in main     seq, request = rpc.request_queue.get(block=true, timeout=0.05)   file "c:\program files\python 3.5\lib\queue.py", line 172, in     raise empty queue.empty  during handling of above exception, exception occurred:  traceback (most recent call last): valueerror: invalid literal int() base 10: '??'  during handling of above exception, exception occurred:  traceback (most recent call last):   file "c:\program files\python 3.5\lib\tkinter\__init__.py", line 1534, in __call__     args = self.subst(*args)   file "c:\program files\python 3.5\lib\tkinter\__init__.py", line 1252, in _substitute     e.num = getint_event(b)   file "c:\program files\python 3.5\lib\tkinter\__init__.py", line 1231, in getint_event     return int(s) systemerror: result error in pyobject_call how reproduce:
open program, press play press a.
i have no idea wrong altough have tried searching on google.
i tried adding prints don't executed.
does know why error?
the problem was using 3.5 instead of 3.4. switching versions worked.
Comments
Post a Comment