fork download
  1. import time
  2. from tkinter import *
  3.  
  4. class Timer(Tk):
  5.  
  6. def __init__ (self):
  7. Tk. __init__(self)
  8. self.geometry('160x40')
  9. self.resizable(0,0)
  10. self.start= round(time.time())
  11. self.m = Label(self,text='Seconds: ' + str(self.start),fg='green',font=30)
  12. self.m.place(x=35,y=8)
  13. time.sleep(1)
  14. self.tick()
  15. self.mainloop()
  16.  
  17. def tick(self):
  18. self.m.configure(text='Seconds: '+str(round(time.time()-self.start)))
  19. self.after(1000, self.tick)
  20.  
  21. t = Timer()
Runtime error #stdin #stdout #stderr 0.04s 26088KB
stdin
Standard input is empty
stdout
Standard output is empty
stderr
Traceback (most recent call last):
  File "./prog.py", line 21, in <module>
  File "./prog.py", line 7, in __init__
  File "/usr/lib/python3.4/tkinter/__init__.py", line 1854, in __init__
    self.tk = _tkinter.create(screenName, baseName, className, interactive, wantobjects, useTk, sync, use)
_tkinter.TclError: no display name and no $DISPLAY environment variable