Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct
How to create a simple user app?
I've installed QT Creator (3.5.1) and created a simple form that I need to integrate into an existing python script. Are there simple, straightforward instructions on how to do this?
Hi and welcome to devnet,
Are you planning on using PyQt ?
@SGaist The python program I have is PyCharm. (is that what you're asking?)
@jn30360 To use the Qt framework on Python you need to use libraries such as PyQt or PySide.
I have included the following code:
from pyside import QtCore
from pyside import QtGui
from pyside import QtUiTools
Not sure what you do next to access objects (i.e., pushbuttons, etc) on the form frmMain.
@jn30360 Hmm i don't think that's gonna work. try something like this:
from PySide import QtCore, QtGui, QtUiTools def loadUiWidget(uifilename, parent=None): loader = QtUiTools.QUiLoader() uifile = QtCore.QFile(uifilename) uifile.open(QtCore.QFile.ReadOnly) ui = loader.load(uifile, parent) uifile.close() return ui if __name__ == "__main__": import sys app = QtGui.QApplication(sys.argv) MainWindow = loadUiWidget(":/forms/myform.ui") MainWindow.show() sys.exit(app.exec_())
Hey that worked, thanks a lot. That gets the form open.
Can you point me to code that interfaces a pushbutton on the form? Need something like:
if <condition1> and not <condition2> etc... :
Just can't find any clear example of how to integrate objects on the form into the script. I've seen some instructions on slots/signals, but can't find clear instructions/examples on how to implement.