-
-
Save Informatic/cd611b4b4163d02708937b5bc45b1e46 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import sys | |
from cx_Freeze import setup, Executable | |
build_exe_options = { | |
"packages": ["PySide", "requests"], | |
"optimize": 2, | |
} | |
setup(name="bugtest app", | |
version="0.1", | |
description="just a simple test", | |
executables=[ | |
Executable("bugtest.py", base=None), | |
], | |
options={"build_exe": build_exe_options}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import sys | |
import requests | |
from PySide import QtCore, QtGui | |
class TestThread(QtCore.QThread): | |
progress = QtCore.Signal(str) | |
def run(self): | |
self.progress.emit('before request') | |
print('doing stuff...') | |
print(requests.get('https://google.com')) | |
print('done') | |
self.progress.emit('after request, done') | |
class MainWindow(QtGui.QMainWindow): | |
def __init__(self, parent=None, app=None): | |
super(MainWindow, self).__init__(parent) | |
self.btn = QtGui.QPushButton(self) | |
self.btn.setText('press me...') | |
self.btn.clicked.connect(self.on_btn_clicked) | |
self.setCentralWidget(self.btn) | |
self.th = TestThread(self) | |
self.th.progress.connect(self.on_thread_progress) | |
def on_btn_clicked(self): | |
self.th.start() | |
def on_thread_progress(self, text): | |
self.btn.setText("progress: %s" % text) | |
if __name__ == "__main__": | |
app = QtGui.QApplication(sys.argv) | |
window = MainWindow() | |
window.show() | |
sys.exit(app.exec_()) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment