pythongui功能_python用pyqt5为程序添加GUI后功能和界面只能二选一运行

引用来自“mr_chip”的评论贴个button的slot代码

self.pushButton = QtWidgets.QPushButton(self.tab)

self.pushButton.setGeometry(QtCore.QRect(10, 120, 75, 23))

self.pushButton.setObjectName("pushButton")

self.pushButton.clicked.connect(self.run)

def starting(self):

# pass

read = HBTiaoShi.readCSV()

read.implementor()

read.getInfo()

# time1 = HBTiaoShi.time.time()

HBTiaoShi.log.initLogConf()

HBTiaoShi.log = HBTiaoShi.logging.getLogger('')

read.openfile("..")

HBTiaoShi.time.sleep(10)

def startingflow(self):

observer = HBTiaoShi.Observer()

event_handler = HBTiaoShi.FileEventHandler()

observer.schedule(event_handler, "..", True)

observer.start()

try:

while True:

HBTiaoShi.time.sleep(600)

except KeyboardInterrupt:

observer.stop()

observer.join()

def run(self):

p=Process(target=self.starting)

p.start()

self.startingflow()

因为我的功能之前都是封装到类中,实例化调用运行的。然后我给它添加GUI后我就不知道要怎么调用。因为我是尽量的一键自动运行,又因为我是一个大整体将每个环节做成了一个function。

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值