I wanted to make a simple stopwatch, so I set up a button to turn on the a timer to update the time label. When I press the button tied to the timer, it doesn't do anything except for print out my start_pause message. I've tried multiple different things, but none of my approaches seemed to have worked. front_basic_timer_ui is the GUI side of the code.
import front_basic_timer_ui
import datetime
import sys
from PyQt4 import QtCore, QtGui
if __name__ == "__main__":
app = QtGui.QApplication(sys.argv)
def update_label():
gui.label.setText("update")
def stop_timer():
print("stop")
def save_timer_log():
print("save")
def start_pause_timer(self):
print("start_pause")
#global set_time
#set_time = datetime.datetime.today()
timer = QtCore.QTimer()
timer.timeout.connect(update_label)
timer.start(100)
#Set the window from imported front_basic_timer_ui
gui_plot = front_basic_timer_ui.QtGui.QMainWindow()
gui = front_basic_timer_ui.Ui_MainWindow()
gui.setupUi(gui_plot)
#Set buttons
gui.pushButton.clicked.connect(save_timer_log)
gui.pushButton_2.clicked.connect(stop_timer)
gui.pushButton_3.clicked.connect(start_pause_timer)
gui_plot.show()
sys.exit(app.exec_())