How to access Qt components loaded from file?

Juan Christian juan0christian at
Tue Nov 18 13:18:09 CET 2014

I have this simple code that load any Qt Designer .UI file:

from PySide.QtCore import QFile
from PySide.QtGui import QApplication
from PySide.QtUiTools import QUiLoader

def loadui(file_name):
loader = QUiLoader()
uifile = QFile(file_name)
ui = loader.load(uifile)
return ui

if __name__ == "__main__":
import sys

app = QApplication(sys.argv)
MainWindow = loadui("main.ui")

Let's say I have a QTextEdit called txtbox. How can I access this txtbox
inside my Python code?
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <>

More information about the Python-list mailing list