def run(self): print("Starting thread " + self.name) # instantiate QApplication for PyQt framework app = QApplication(sys.argv) # instantiate main window window = MainWindow(self.port) # show the main window window.show() # bring the main window to the front window.raise_() # execute the application - start watching for events etc. app.exec_() print("Exiting thread " + self.name)
def main(): import sys app = QApplication(sys.argv) wnd = MainWindow() # ---------------------- Init Mainwindow ------------------------------ qr = wnd.frameGeometry() cp = QDesktopWidget().availableGeometry().center() qr.moveCenter(cp) wnd.move(qr.topLeft()) wnd.listLib.setSortingEnabled(True) wnd.initFaceCompare() wnd.initCamera() # -------------------------------------------------------------------------------- wnd.show() sys.exit(app.exec_())
import sys from PyQt5.QtWidgets import QApplication from UI.MainWindow import MainWindow q_app = QApplication(sys.argv) window = MainWindow() window.show() window.setFixedSize(window.size()) q_app.exec_()
from UI.SetupWiizard import ConfigWizard from UI.MainWindow import MainWindow try: _fromUtf8 = QtCore.QString.fromUtf8 except AttributeError: def _fromUtf8(s): return s try: _encoding = QtGui.QApplication.UnicodeUTF8 def _translate(context, text, disambig): return QtGui.QApplication.translate(context, text, disambig, _encoding) except AttributeError: def _translate(context, text, disambig): return QtGui.QApplication.translate(context, text, disambig) if __name__ == "__main__": if hasattr(sys, 'frozen'): currentPath = os.path.abspath(sys.argv[0]) else: currentPath = os.path.abspath(os.path.realpath(__file__)) utils.setProgramPath(currentPath) import sys app = QtGui.QApplication(sys.argv) if not transferPC.init_config(): wizard = ConfigWizard() wizard.show() else: mainWindow = MainWindow() mainWindow.show() sys.exit(app.exec_())
import sys from PyQt4 import QtGui from UI.MainWindow import MainWindow import os #defines _DEBUG = True _WORKING_DIR = os.path.dirname(__file__) # Debug calls for launch if _DEBUG: pass # Creating App app = QtGui.QApplication(sys.argv) # Initializing UI RootWindow = MainWindow() RootWindow.show() # Waiting for exit sys.exit(app.exec_())
import sys from PyQt5.QtWidgets import QApplication from UI.MainWindow import MainWindow from MessageHandler.ChatMessageReceiver import ChatMessageReceiver import time if __name__ == "__main__": # 开启图形界面循环 app = QApplication(sys.argv) main = MainWindow() main.show() chat_message_receiver = ChatMessageReceiver() # 消息接收器的信号 chat_message_receiver.receive_text_signal.connect(main.receive_text) chat_message_receiver.send_successfully_signal.connect( main.ChatRecordInterface.add_msg) chat_message_receiver.start_itchat_signal.connect( main.FriendControllInterface.read_all_friend_with_record) chat_message_receiver.set_closest_msg_after_success_signal.connect( main.FriendControllInterface.set_closest_msg) # 界面控件的信号 main.exit_proc_signal.connect(chat_message_receiver.end) main.ChatRecordInterface.send_msg_signal.connect( chat_message_receiver.send_msg) chat_message_receiver.start() status = app.exec_() # 界面关闭,等待微信监控程序关闭,等待5秒 timer = 0.0 while chat_message_receiver.isRunning():