So i wrote this program, everything works fine but i want to add a "layout" to clean it up a bit. But when i do and then go to run it it tells me that there is already a layout or format in place and all the widgets appear on top of each other in the top right hand corner. what am i missing.
import sys
from PyQt4 import QtCore, QtGui, uic
form_class = uic.loadUiType("/Users/Home/Desktop/Timer/timer.ui")[0] # Load the UI
class MyWindowClass(QtGui.QMainWindow, form_class):
def __init__(self, parent=None):
QtGui.QMainWindow.__init__(self, parent)
self.setupUi(self)
self.start_btn = self.startButton
self.start_btn.clicked.connect(self.tick)
def tick(self):
start_time = int(self.timeStart.text())
stop_time = int(self.timeStop.text())
orders = int(self.tot_orders.text())
hours = int((stop_time - start_time) / 100)
if hours > 2:
hours = hours - 0.25
elif hours > 5:
hours = hours - 0.45
elif hours > 7:
hours = hours - 1
speed = orders / hours
str_speed = "{:.2f}".format(speed)
output = (str_speed+" orders per hour")
self.progressLbl.setText(output)
app = QtGui.QApplication(sys.argv)
myWindow = MyWindowClass(None)
myWindow.show()
app.exec_()
Aucun commentaire:
Enregistrer un commentaire