Python Forum
python interactive output with Qt4
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
python interactive output with Qt4
#1
I am trying to print a fibonacci sequence in a QTextEdit box in Qt4 and I am only getting the last number. How do I print the whole sequence my code is

class MyApp(QtGui.QMainWindow, Ui_MainWindow):
def __init__(self):
QtGui.QMainWindow.__init__(self)
Ui_MainWindow.__init__(self)
self.setupUi(self)
self.runButton.clicked.connect(self.calculate)

## Fibonacci sequence code
def calculate(self):

a, b = 0, 1

while b < 10:

t = str(b)
output = t
self.outputText.setText(output)

a, b = b, a+b




if __name__ == "__main__":
app = QtGui.QApplication(sys.argv)
window = MyApp()
window.show()
sys.exit(app.exec_())
Reply


Messages In This Thread
python interactive output with Qt4 - by eegrek39 - Mar-18-2018, 07:51 AM

Possibly Related Threads…
Thread Author Replies Views Last Post
  "Interactive" figure in a GUI puje 2 4,621 Jun-24-2020, 06:55 PM
Last Post: puje

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020