Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. Qt for Python
  4. Qt designer window not showing
Forum Updated to NodeBB v4.3 + New Features

Qt designer window not showing

Scheduled Pinned Locked Moved Unsolved Qt for Python
3 Posts 3 Posters 3.1k Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • S Offline
    S Offline
    SandraB
    wrote on last edited by
    #1

    HI. Have been playing around with PyQt5 tutorials. Discovered Qt Designer. Designed a basic layout, again following a tutorial. Cannot get it to show. Any pointers? What am I missing?

    Thanks

    Program:

    from PyQt5 import QtCore, QtGui, QtWidgets
    from PyQt5.QtWidgets import QDialog, QApplication, QWidget

    class Ui_MainWindow(object):
    def setupUi(self, MainWindow):
    MainWindow.setObjectName("MainWindow")
    MainWindow.resize(800, 600)
    self.centralwidget = QtWidgets.QWidget(MainWindow)
    self.centralwidget.setObjectName("centralwidget")
    self.combox = QtWidgets.QComboBox(self.centralwidget)
    self.combox.setGeometry(QtCore.QRect(40, 120, 111, 31))
    font = QtGui.QFont()
    font.setPointSize(10)
    self.combox.setFont(font)
    self.combox.setObjectName("combox")
    self.combox.addItem("")
    self.combox.addItem("")
    self.comboy = QtWidgets.QComboBox(self.centralwidget)
    self.comboy.setGeometry(QtCore.QRect(230, 120, 111, 31))
    font = QtGui.QFont()
    font.setPointSize(10)
    self.comboy.setFont(font)
    self.comboy.setObjectName("comboy")
    self.comboy.addItem("")
    self.comboy.addItem("")
    self.Submit = QtWidgets.QPushButton(self.centralwidget)
    self.Submit.setGeometry(QtCore.QRect(140, 410, 111, 31))
    font = QtGui.QFont()
    font.setPointSize(10)
    self.Submit.setFont(font)
    self.Submit.setObjectName("Submit")
    self.label = QtWidgets.QLabel(self.centralwidget)
    self.label.setGeometry(QtCore.QRect(130, 250, 141, 61))
    font = QtGui.QFont()
    font.setPointSize(12)
    self.label.setFont(font)
    self.label.setObjectName("label")
    MainWindow.setCentralWidget(self.centralwidget)
    self.menubar = QtWidgets.QMenuBar(MainWindow)
    self.menubar.setGeometry(QtCore.QRect(0, 0, 800, 21))
    self.menubar.setObjectName("menubar")
    MainWindow.setMenuBar(self.menubar)
    self.statusbar = QtWidgets.QStatusBar(MainWindow)
    self.statusbar.setObjectName("statusbar")
    MainWindow.setStatusBar(self.statusbar)

        self.retranslateUi(MainWindow)
        QtCore.QMetaObject.connectSlotsByName(MainWindow)
    
        self.InitUI_MainWindow()
    
    def retranslateUi(self, MainWindow):
        _translate = QtCore.QCoreApplication.translate
        MainWindow.setWindowTitle(_translate("MainWindow", "MainWindow"))
        self.combox.setItemText(0, _translate("MainWindow", "0"))
        self.combox.setItemText(1, _translate("MainWindow", "1"))
        self.comboy.setItemText(0, _translate("MainWindow", "0"))
        self.comboy.setItemText(1, _translate("MainWindow", "1"))
        self.Submit.setText(_translate("MainWindow", "Submit"))
        self.label.setText(_translate("MainWindow", "x xor y ="))
    

    if name == "main":
    import sys
    app = QtWidgets.QApplication(sys.argv)
    Ui_MainWindow = QtWidgets.QMainWindow
    ui = Ui_MainWindow()
    sys.exit(app.exec_())

    1 Reply Last reply
    0
    • SGaistS Offline
      SGaistS Offline
      SGaist
      Lifetime Qt Champion
      wrote on last edited by
      #2

      Hi and welcome to devnet,

      From a quick look you don't call the show method of your UI_MainWindow object anywhere, therefore nothing is shown.

      Interested in AI ? www.idiap.ch
      Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

      1 Reply Last reply
      1
      • S Offline
        S Offline
        SandraB
        wrote on last edited by
        #3

        Hi.

        Denni O. I have picked up vaguely that Designer was going to be a pig to work with. I just found the learning process of PyQt fairly hard work, though maybe I just need to find the right tutorial.

        SGaist. Thank you. Ok will have a look at this.

        1 Reply Last reply
        0

        • Login

        • Login or register to search.
        • First post
          Last post
        0
        • Categories
        • Recent
        • Tags
        • Popular
        • Users
        • Groups
        • Search
        • Get Qt Extensions
        • Unsolved