here2share

# Tk_Zero_Window_Frame.py

Sep 26th, 2020 (edited)
1,152
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 1.27 KB | None | 0 0
  1. # Tk_Zero_Window_Frame.py -- sort of hack
  2.  
  3. try:
  4.     from Tkinter import *
  5. except:
  6.     from tkinter import *
  7.    
  8. import time
  9.  
  10. to_exit = 'you may left-click mouse directly on\nthis text to exit'
  11. mask = "#393939"
  12.  
  13. def colorYield():
  14.     while 1:
  15.         for r in range(0,255,16):
  16.             for g in range(0,255,16):
  17.                 for b in range(0,255,16):
  18.                     if r+g+b > 80*3:
  19.                         break
  20.                 t = '#%02x%02x%02x'%(r,g,b)
  21.                 yield t
  22. color = colorYield()
  23. root = Tk()
  24. ww = root.winfo_screenwidth()
  25. hh = root.winfo_screenheight()
  26. root.geometry(str(ww+10)+"x"+str(hh+10)+"+-10+-32") # to hide the frame
  27. root.title('Zero Window Frame')
  28. root.attributes("-transparentcolor", mask)
  29. root.configure(background=mask)
  30. e=Label(root, text=to_exit, padx=30, anchor='s', bg=mask, width=ww, height=3, font=('Helvetica', 50, 'italic'), fg=next(color))
  31. e.pack()
  32. t=Label(root, padx=0, anchor='sw', bg=mask, width=ww, font=('Helvetica', 250, 'bold italic'), fg='red')
  33. t.pack()
  34. root.pack_propagate(0)
  35.  
  36. def exit(event=0):
  37.     root.destroy()
  38. def update_clock():
  39.     now = time.strftime("%H:%M:%S")
  40.     t.configure(text=now)
  41.     root.after(1000, update_clock)
  42. def update_color():
  43.     e.configure(fg=next(color))
  44.     root.after(50, update_color)
  45. root.bind('<Button-1>', exit)
  46. update_clock()
  47. update_color()
  48.  
  49. root.mainloop()
Add Comment
Please, Sign In to add comment