def run(): app = QApplication([]) app.setStyleSheet(qdarkstyle.load_stylesheet_pyqt5()) wind = PandasController() wind.show() app.exec()
def main(): app = QApplication(sys.argv) app.setOrganizationName("KARE Ltd.") app.setOrganizationDomain("KAREyiz.biz") app.setApplicationName("PT-Tester") app.setWindowIcon(QIcon("images/icon.png")) form = MainWindow() form.show() app.exec()
def go(name): from PyQt5.Qt import QApplication, Qt, QLabel app = QApplication([]) mw = QLabel() mw.setAlignment(Qt.AlignCenter) mw.setMinimumSize(150, 50) mw.setText('Hello, ' + name) mw.show() app.exec()
def main(): if not check_run_as_admin(): raise KiwoomPrivilegeError("키움 OpenAPI 모듈은 관리자권한에서만 정상실행 됩니다") parsed_args, unparsed_args = parse_args() # QApplication expects the first argument to be the program name qt_args = sys.argv[:1] + unparsed_args app = QApplication(qt_args) broker_url = parsed_args.broker_url kiwoom_module = KiwoomModule(Messenger(broker_url)) kiwoom_module.connect() app.exec()
def start_monitor(groups, port, need_win=False): recn = Recon(model_dir_, path_imagegroup_map) start_listen_noblock(port) app = QApplication([]) # xmpp = PyQtClientWrap(None) # xmpp.set_no_verify() # xmpp.connect_to_host(b"test1@%s" % xmpp_server_host, b"test") xmpp = None win = None if need_win: win = NeedShow(None) win.show() t = Monitor(groups, recn, xmpp, win) t.setDaemon(True) t.start() app.exec()
def main(): import sys import argparse parser = argparse.ArgumentParser(description='Renderer.\n Usage: ' + sys.argv[0] + '--obj object-filename' + '--renderer gl') parser.add_argument('--obj', type=str, help='Wavefront OBJ file path', default='../data/bunny.obj') parser.add_argument('--renderer', type=str, help='Renderer to use', default='gl') args = parser.parse_args() app = QApplication(sys.argv) if args.renderer == 'gl21': window = create_OGL_window(2, 1, obj_filename=args.obj, title='OpenGL 2.1 Renderer') elif args.renderer == 'gl': window = create_OGL_window(None, None, obj_filename=args.obj, title='OpenGL Renderer') else: raise ValueError('Renderer {} not implemented.'.format(args.rederer)) window.show() sys.exit(app.exec())
#!/usr/bin/env python3 # -*- coding: utf-8 -*- __author__ = 'ipetrash' from PyQt5.Qt import QApplication, QLabel, QVBoxLayout, QWidget app = QApplication([]) app.setStyleSheet('QLabel { font: bold italic }') label_1 = QLabel() label_1.setText('Hello World!!!') label_2 = QLabel() label_2.setText('nothing...') layout = QVBoxLayout() layout.addWidget(label_1) layout.addWidget(label_2) mw = QWidget() mw.setLayout(layout) mw.show() app.exec()
try: postid = self.lineEdit.text() # 订单号获取 query = Express(postid=postid) # 传递订单号 query.parse() # 执行解析 with open('express.txt', 'r+', encoding='utf-8')as f: detail = f.read() # 读取内容 self.textEdit.setText(detail) # 显示文本 f.seek(0) # 定位到开头 f.truncate() # 删除内容 except Exception: pass pass def deldetail(self): ''' 清空文本信息 :return: ''' self.textEdit.clear() self.lineEdit.clear() pass if __name__ == '__main__': app = QApplication(sys.argv) win = ExpressWindows() win.show() # 4600284951052 sys.exit(app.exec())
self.timer.start(300) def update_image(self): w, h, c, dt = get_pic(10) if not isinstance(dt, bytes): return # array = np.frombuffer(dt, dtype=np.uint8).reshape((h, w, c)) # array = array.transpose((1, 0, 2)).copy() # array = cv2.transpose(array) # cv2.imshow("aa", array) image = QImage(dt, w, h, QImage.Format_RGB888) palette = self.widget.palette() image = image.scaled(self.widget.geometry().width(), self.widget.geometry().height()) palette.setBrush(QPalette.Background, QBrush(image)) self.widget.setPalette(palette) self.widget.update() if __name__ == '__main__': src = [ "rtsp://*****:*****@192.168.1.201/Streaming/Channels/1", "rtsp://*****:*****@192.168.1.202/Streaming/Channels/1", # "rtmp://media3.sinovision.net:1935/live/livestream", # "http://ivi.bupt.edu.cn/hls/cctv6hd.m3u8", ] q = QApplication([]) w = MyWindow(None) w.show() q.exec()
# jsFile = constants.QTWEBCHANNELJS_FILE # with open(jsFile, encoding="UTF-8") as file: # js = file.read() # script = QWebEngineScript(); # script.setSourceCode(js) # script.setName('qwebchannel.js') # script.setInjectionPoint(QWebEngineScript.DocumentCreation) # script.setWorldId(QWebEngineScript.MainWorld) # script.setRunsOnSubFrames(False) # # mainwindow.view.page.profile().scripts().insert(script) channel = QWebChannel() myobject=myObject() channel.registerObject("xdpy",myobject) mainwindow.view.page.setWebChannel(channel) # # jsFile = constants.QTWEBCHANNELJS_FILE # with open(jsFile, encoding="UTF-8") as file: # js = file.read() # mainwindow.injectJS(js, 'qwebchannel.js') js='\nnew QWebChannel(qt.webChannelTransport, function(channel){alert("正在调用回调函数");window.xdpy=channel.objects.xdpy;xdpy.test();});\n' #mainwindow.view.page.runJavaScript(js,mainwindow.js_callback) # mainwindow.view.page.runJavaScript('window.channel="AAAA"', mainwindow.js_callback) mainwindow.view.page.runJavaScript(js,mainwindow.js_callback) #mainwindow.view.page.runJavaScript("window.xdpy.test()",mainwindow.js_callback) app.exec();
def main(): app = QApplication(sys.argv) ex = App() app.exec()
def exec(self) -> int: app = QApplication([]) app.setStyle('Fusion') window = MyWindow() window.show() return app.exec()
from PyQt5.Qt import QApplication, QRegExpValidator, QRegExp from PyQt5.QtWidgets import QWidget, QLineEdit import sys class MyWidget(QWidget): def __init__(self, parent=None): super(QWidget, self).__init__(parent) self.le_input = QLineEdit(self) reg_ex = QRegExp("[1-9]+.?[0-9]{,2}") input_validator = QRegExpValidator(reg_ex, self.le_input) self.le_input.setValidator(input_validator) if __name__ == '__main__': a = QApplication(sys.argv) w = MyWidget() w.show() a.exec()
def main(): app = QApplication(sys.argv) window = MazeWindow() window.show() sys.exit(app.exec())