我有一个具有登录屏幕的脚本,如果按下取消按钮,我想完全退出应用程序.我试过3种方法:
只有1号才有效.另外两个使对话框变白,然后闪烁然后挂起,我甚至无法切换到其他应用程序.我的代码如下:
from PyQt5.QtCore import *
from PyQt5.QtGui import *
from PyQt5.QtSql import *
from PyQt5.QtWidgets import *
import csv
import sys
from datetime import datetime, timedelta, time
import os
from ci_co_table import *
from login import *
class Ci_Co(QMainWindow):
"""Check in and check out module"""
def __init__(self, parent=None):
QWidget.__init__(self, parent)
self.ui = Ui_MainWindow()
self.ui.setupUi(self)
class Login(QDialog):
"""User login """
def __init__(self):
QDialog.__init__(self)
self.ui = Ui_login_form()
self.ui.setupUi(self)
self.ui.buttonBox.accepted.connect(lambda: self.handle_login(servers=servers))
servers = {}
with open('servers.csv', newline='') as csvfile: …
Run Code Online (Sandbox Code Playgroud) 我试图使用Microsoft Access 2003中的自动化来控制Internet Explorer 9以使用数据库数据完成表单.
输入在浏览器中触发一个事件,该事件验证数据并使保存按钮可见.如果我使用sendkeys,则触发事件; 但是,我发现sendkeys非常不可靠.如果我更改元素的值然后使用.fireevent("onchange"),则没有任何反应 - 甚至不是错误.
我的问题是,我该怎么解雇这个事件.或者,我怎样才能找出正在运行的javascript.是否有IE的调试类型的插件,它会告诉我什么事件被触发?如果是这样,我可以自己运行脚本吗?
我的代码如下.
Set IE = CreateObject("internetexplorer.application")
IE.Visible = True
IE.Navigate "https://extranet.website.com/Planning/Edition/Periodic?language=en"
Do While IE.ReadyState <> 4 Or IE.Busy = True
DoEvents
Loop
'log in
If IE.Document.Title = "website- access" Then
IE.Document.getElementById("login_uid").Value = "username"
IE.Document.getElementById("login_pwd").Value = "password"
IE.Document.all("ButSubmit").Click
Do While IE.ReadyState <> 4 Or IE.Busy = True
DoEvents
Loop
End If
Do While Not RstAvailability.EOF
StartDate = RstAvailability!AvailDate
IE.Document.getElementById("periodStart").Value = Format(StartDate, "dd mmm yy")
IE.Document.getElementById("periodEnd").Value = Format(StartDate, "dd mmm yy")
Set LinkCollection …
Run Code Online (Sandbox Code Playgroud)