May-25-2018, 07:46 AM
hello,
im using a pyqt5 for building a gui.
i want that clicking a button will execute gps.py script.
here is the relevant piece of code
thanks
im using a pyqt5 for building a gui.
i want that clicking a button will execute gps.py script.
here is the relevant piece of code
def window():
app = QtWidgets.QApplication(sys.argv)
w = QtWidgets.QWidget()
blunch = QtWidgets.QPushButton(w)
blunch.setStyleSheet("background-color:white;")
blunch.resize(300,96)
blunch.move (200,300)
blunch.setText("Lunch")
blunch.setFont(QtGui.QFont('', 15))
blunch.clicked.connect(gps.runscript())here is the code from the gps.py:from random import uniform
import time
def runscript():
for gps in range(0, 10):
gps = round(uniform(31.852863, 31.853108), (6))
time.sleep(2)
print(gps)the "error that i get is what the gps.py runs before the GUI, regardless if the button was clicked.thanks
