Windows10/Python3
So i have the beep.pyw file located in startup:shell, it beeps every 30 minutes automatically when you open the pc.
And i'm using Tkinter to make a GUI widget "widget.py" which contains 4 advices to do in the breaks like (breathing stretching, hydrating etc...) = Done
Problem is:
How to open the widget every time the pc beeps. Should i put both files in one file or how can i add the statement to open the "widget.py" in the "beep.pyw"?
This is the beep.pyw:
import time
import winsound
beep_time = 30*60
def beep_every60():
while True :
winsound.Beep(2000, 1000)
winsound.Beep(2000, 1000)
time.sleep(beep_time)
beep_every60()
import time
import winsound
from tkinter import *
class WindowsBeep(Tk):
def __init__(self):
super().__init__()
self.title_ = "Windows Beep"
self.title(self.title_)
self.bg = "#222222"
self.fg = "#cccccc"
self["bg"] = self.bg
self.__largura_tela__ = self.winfo_screenwidth()
self.__altura_tela__ = self.winfo_screenheight()
self.porcentagem_largura = 0.50
self.porcentagem_altura = 0.75
self.__largura_app__ = int(self.__largura_tela__ * self.porcentagem_largura)
self.__altura_app__ = int(self.__altura_tela__ * self.porcentagem_altura)
self.centro_l_janela = int((self.__largura_tela__ // 2) - (self.__largura_app__ // 2) + 2)
self.centro_a_janela = int((self.__altura_tela__ * (1 - self.porcentagem_altura)) // 2)
self.__center__ = f"{self.__largura_app__}x{self.__altura_app__}+{self.centro_l_janela}+{self.centro_a_janela}"
self.geometry(self.__center__)
beep_time = 30*60
def beep_every60():
while True :
winsound.Beep(2000, 1000)
winsound.Beep(2000, 1000)
WindowsBeep().mainloop()
time.sleep(beep_time)
beep_every60()
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.