Dialog.close直接通过clicked.connect起作用,但是当我添加到函数时不起作用

时间:2019-05-27 22:53:47

标签: python pyqt pyqt5

在关闭pyqt5项目中的 import pandas as pd import csv def main(): req = pd.read_csv('/Users/user/web/python/Book copy.csv') account = 'test' transferType = 'Loan' comment = "test" with open('data2.csv', 'w') as csv_file: writer = csv.writer(csv_file, delimiter=';') writer.writerow(['"type"','"currency"','"amount"','"comment"']) for i in range(len(req)): currency = req['Currency'].values[i] reqAmount = req['Request'].values[i] r = round(reqAmount, -1) data = [transferType, account, currency, r, comment] writer.writerow(data) print("DONE") if __name__ == '__main__': main() 之前,我需要检查一些东西。

当我这样做时

Dialog

该窗口将立即关闭。

但是如果我添加这样的功能:

self.logInToolButton.clicked.connect(Dialog.close)

它在 self.logInToolButton.clicked.connect(self.log_in) def log_in(self): print('activated') backoffice.isAuthenticated = True print('logged in ') Dialog.close print('closed') print(backoffice.isAuthenticated) 行崩溃了,还有更好的方法吗?

0 个答案:

没有答案