[PyQt] Re: PyQt4 - Display text on GUI Window:

M.Chavez dunwitch at gmail.com
Sun Oct 25 20:19:56 GMT 2009


I think I'm getting closer, here is an updated version with all the SQLite3
taken out. Everything loads fine, but nothing gets sent to the MainWindow.

import sys, random, sqlite3, os
> from PyQt4.QtCore import *
> from PyQt4.QtGui import *
> from PyQt4 import QtGui, QtCore
> from geodesic import Ui_MainWindow
>
> class gameWindow(QtGui.QMainWindow):
>     def __init__(self, parent=None):
>         super(gameWindow, self).__init__(parent)
>         QtGui.QMainWindow.__init__(self)
>         self.ui = Ui_MainWindow()
>         self.ui.setupUi(self)
>
>         buttonHarvest = QPushButton("Harvest") #Create the harvest button -
> but QT Designer made it?
>         buttonMining = QPushButton("Mining") # Create the mining button -
> but QT Designer made it?
>         self.label = QLabel("Example") # Set the empty label that's not
> showing
>
>         self.connect(buttonHarvest, SIGNAL("clicked()"), self.skillHarvest)
> #Gets from def skillHarvest
>         self.setWindowTitle("Geodesic")
>         # Next
> -------------------------------------------------------------------------------------
>         self.connect(buttonMining, SIGNAL("clicked()"), self.skillMining)
> #Gets from def skillMining
>
>     def skillHarvest(self):
>         harvest = "You find some roots."
>         self.label.setText(harvest)
>
>     def skillMining(self):
>         mining = "You found some gold."
>         self.label.setText(mining)
>
> app = QApplication(sys.argv)
> showWindow = gameWindow()
> showWindow.show()
> app.exec_()
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.riverbankcomputing.com/pipermail/pyqt/attachments/20091025/535e19d5/attachment.html


More information about the PyQt mailing list