我试着在app/form/window启动时调用我的keypress_request()
函数,但它没有被调用?
我有办法做到吗?在
import time
from PyQt5 import QtCore, QtGui, QtWidgets
from screenkeep import Ui_MainWindow
from keypress_m import perform_keypress
from multiprocessing import Process
class ScreenKeepProgram(Ui_MainWindow):
def __init__(self, parent=None):
super(ScreenKeepProgram, self).__init__(self)
self.setupUi(self)
# This below is the function I want to call
# at the start of the program, with no success
self.keypress_request()
def keypress_action(self):
while True:
time.sleep(5)
perform_keypress('o')
def keypress_request(self):
do_keypress = Process(target=self.keypress_action)
do_keypress.daemon = True
do_keypress.start()
目前没有回答
相关问题 更多 >
编程相关推荐