0

I am new to coding and python. I use tkinter to make an app and want to know how to allow your clicks to affect the apps and stuff behind my app without interacting with my app. My app is designed to turn the screen pink by adding a transparent overlay. I want to make the overlay visible but not affecting the other apps or pc.(https://i.stack.imgur.com/UW4tR.png)](https://i.stack.imgur.com/UW4tR.png)

I have tried looking at other posts and found solutions but none worked quite right. This is my current code. How it is expected to work is the overlay is there but you can interact with everything behind it as if the app was not there.

import tkinter as tk
from tkinter import *
import time
from tkinter import ttk
from tkinter import messagebox
win = tk.Tk()
win.title("Pink-Out")
win.geometry("1900x1000")
win.attributes('-alpha',1)
win.configure(bg='black')

sec = StringVar()
Entry(win, textvariable=sec, width = 2, font = 'Helvetica 14').place(x=1720, y=900)
sec.set('00')
mins= StringVar()
Entry(win, textvariable = mins, width =2, font = 'Helvetica 14').place(x=1680, y=900)
mins.set('00')
hrs= StringVar()
Entry(win, textvariable = hrs, width =2, font = 'Helvetica 14').place(x=1640, y=900)
hrs.set('00')

def pink():
    command = win.configure(bg='#FF007F')
    command = win.attributes('-fullscreen', True)
    command = win.attributes('-alpha', 0.10, '-topmost', 1)
    messagebox.showinfo("", "Remeber to look away from your screen every 20 min to protect your eyes.")
    # hide the button
    for i in range(1,100):

        times = int(hrs.get())*3600+ int(mins.get())*60 + int(sec.get())
        while times > -1:
          minute,second = (times // 60 , times % 60)
          hour =0
          if minute > 60:
             hour , minute = (minute // 60 , minute % 60)
          sec.set(second)
          mins.set(minute)
          hrs.set(hour)
          #Update the time
          win.update()
          time.sleep(1)
          if(times == 0):
             sec.set('00')
             mins.set('20')
             hrs.set('00')
             messagebox.showinfo("", "Take a break")
          times -= 1
     
   
b1 = tk.Button(win, text='START', bd ='2', bg = 'IndianRed1',font =('Helvetica bold',10),  command = pink).place(x=2667, y=925)
win.bind('<Return>', lambda event:pink())
win.mainloop()

1 Answers1

0

This is not an answer. I will delete it sooner.

Your Entry and Button is out of window. I am not going to try this. In Line 8, I changed window size.

win.geometry("640x480")

In line 13,. Change this: Entry(win, textvariable=sec, width = 2, font = In line 13, 'Helvetica 14').place(x=20, y=90)

In line 16. Change this: Entry(win, textvariable = mins, width =2, font = 'Helvetica 14').place(x=50, y=90)

In line 19. Change this: Entry(win, textvariable = hrs, width =2, font = 'Helvetica 14').place(x=80, y=90)

In Line 50. Change this: b1 = tk.Button(win, text='START', bd ='2', bg = 'IndianRed1',font =('Helvetica bold',10), command = pink).place(x=26, y=25)

Result:

enter image description here

toyota Supra
  • 3,181
  • 4
  • 15
  • 19