簡體   English   中英

我需要幫助為 windows 構建 python 應用程序

[英]I need help Building a python app for windows

Windows10/Python3

所以我的 beep.pyw 文件位於啟動:shell,當你打開電腦時,它每 30 分鍾自動發出嗶聲。

我正在使用 Tkinter 制作一個 GUI 小部件“widget.py”,其中包含 4 個建議在休息時做(呼吸拉伸、補水等)= 完成

問題是:

每次電腦發出嗶嗶聲時如何打開小部件。 我應該將兩個文件放在一個文件中還是如何添加語句以在“beep.pyw”中打開“widget.py”?

這是 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()

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM