here2share

# Tk_Zero_Window_Frame.py

Sep 26th, 2020 (edited)
790
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  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.         while 1:
  16.             for r in range(0,255,16):
  17.                 for g in range(0,255,16):
  18.                     for b in range(0,255,16):
  19.                         if r+g+b > 80*3:
  20.                             break
  21.                     t = '#%02x%02x%02x'%(r,g,b)
  22.                     yield t
  23. color = colorYield()
  24. root = Tk()
  25. ww = root.winfo_screenwidth()
  26. hh = root.winfo_screenheight()
  27. root.geometry(str(ww+10)+"x"+str(hh+10)+"+-10+-32") # to hide the frame
  28. root.title('Zero Window Frame')
  29. root.attributes("-transparentcolor", mask)
  30. root.configure(background=mask)
  31. e=Label(root, text=to_exit, padx=30, anchor='s', bg=mask, width=ww, height=3, font=('Helvetica', 50, 'italic'), fg=color.next())
  32. e.pack()
  33. t=Label(root, padx=0, anchor='sw', bg=mask, width=ww, font=('Helvetica', 250, 'bold italic'), fg='red')
  34. t.pack()
  35. root.pack_propagate(0)
  36.  
  37. def exit(event=0):
  38.     root.destroy()
  39. def update_clock():
  40.     now = time.strftime("%H:%M:%S")
  41.     t.configure(text=now)
  42.     root.after(1000, update_clock)
  43. def update_color():
  44.     e.configure(fg=color.next())
  45.     root.after(50, update_color)
  46. root.bind('<Button-1>', exit)
  47. update_clock()
  48. update_color()
  49.  
  50. root.mainloop()
RAW Paste Data