0

Trying to run the following on a Raspberry Pi from Mouse Position Python Tkinter

import Tkinter as tk
root = tk.Tk()

def motion(event):
    x, y = event.x, event.y
    print('{}, {}'.format(x, y))

root.bind('<Motion>', motion)
root.mainloop()

but get the following error

_tkinter.TclError: no display name and no $DISPLAY environment variable

Can any Python experts suggest a solution?

Community
  • 1
  • 1
Bachalo
  • 6,965
  • 27
  • 95
  • 189
  • Found my answer, http://www.raspberrypi.org/forums/viewtopic.php?f=32&t=35995programs that use GUIs cant be started from SSH terminal, either start it on the raspberry pi or through vnc server – Bachalo Jul 03 '14 at 14:07
  • You can answer your own question and accept it. – Lafexlos Jul 03 '14 at 14:12
  • in addition for the above to work I need to launch the desktop environment – Bachalo Jul 03 '14 at 14:17

0 Answers0