call script from tkinter - Raspberry Pi Forums
pretty new this, trying call script button in tkinter
import tkinter tk
import subprocess sub
window_size = "600x400"
root = tk.tk()
root.geometry(window_size)
tk.button(root, text="create motion!", command=lambda: sub.call('home/pi/motion1.py')).pack()
getting error
>>> exception in tkinter callback
traceback (most recent call last):
file "/usr/lib/python3.5/idlelib/run.py", line 125, in main
seq, request = rpc.request_queue.get(block=true, timeout=0.05)
file "/usr/lib/python3.5/queue.py", line 172, in get
raise empty
queue.empty
during handling of above exception, exception occurred:
traceback (most recent call last):
file "/usr/lib/python3.5/tkinter/__init__.py", line 1562, in __call__
return self.func(*args)
file "/home/pi/animationgui.py", line 11, in <lambda>
tk.button(root, text="create motion!", command=lambda: sub.call('home/pi/motion1.py')).pack()
file "/usr/lib/python3.5/subprocess.py", line 247, in call
popen(*popenargs, **kwargs) p:
file "/usr/lib/python3.5/subprocess.py", line 676, in __init__
restore_signals, start_new_session)
file "/usr/lib/python3.5/subprocess.py", line 1282, in _execute_child
raise child_exception_type(errno_num, err_msg)
filenotfounderror: [errno 2] no such file or directory: 'home/pi/motion1.py'
sorry if basic question newbie @ in advance
import tkinter tk
import subprocess sub
window_size = "600x400"
root = tk.tk()
root.geometry(window_size)
tk.button(root, text="create motion!", command=lambda: sub.call('home/pi/motion1.py')).pack()
getting error
>>> exception in tkinter callback
traceback (most recent call last):
file "/usr/lib/python3.5/idlelib/run.py", line 125, in main
seq, request = rpc.request_queue.get(block=true, timeout=0.05)
file "/usr/lib/python3.5/queue.py", line 172, in get
raise empty
queue.empty
during handling of above exception, exception occurred:
traceback (most recent call last):
file "/usr/lib/python3.5/tkinter/__init__.py", line 1562, in __call__
return self.func(*args)
file "/home/pi/animationgui.py", line 11, in <lambda>
tk.button(root, text="create motion!", command=lambda: sub.call('home/pi/motion1.py')).pack()
file "/usr/lib/python3.5/subprocess.py", line 247, in call
popen(*popenargs, **kwargs) p:
file "/usr/lib/python3.5/subprocess.py", line 676, in __init__
restore_signals, start_new_session)
file "/usr/lib/python3.5/subprocess.py", line 1282, in _execute_child
raise child_exception_type(errno_num, err_msg)
filenotfounderror: [errno 2] no such file or directory: 'home/pi/motion1.py'
sorry if basic question newbie @ in advance
raspberrypi
Comments
Post a Comment