Python Forum
[PyQt] integrating Pydesigner and python
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
[PyQt] integrating Pydesigner and python
#1
Im sure there must be an answer for this but after 3 days of googling i cant figure this so sorry if its already been asked 100 times.

After using designer i need a way to import the .ui file and then start coding with it without changing that actual .ui file (so i can make alterations with designer in the future) but although i can import it and run it i can not figure how to access the widgets. I tried so many different examples but they are mostly pyqt4.

import sys

from PyQt5 import uic, QtWidgets


class Ui(QtWidgets.QDialog):
    def __init__(self):
        super(Ui, self).__init__()
        uic.loadUi('untitled.ui', self)
        self.setWindowTitle("greg")                       # I can access the window title.
        self.pushButton.setText("test")                   # cant access the button ????
        self.pushButton.clicked.connect(self.label.clear) # cant access the label or button or connect button to a class/function i can build here ??
        self.show()


if __name__ == '__main__':
    app = QtWidgets.QApplication(sys.argv)
    window = Ui()
    sys.exit(app.exec_())
I just need an example so i can start building the code to go with the GUI.

Actually it does work but it the auto code complete thats the problem, it does not work with the imported .ui class

e.g. (No pushButton showing up at all here) ? This will make it really hard for me to work with how can i get it to work?

[Image: NeU0LX5.png]

I tried to delete this thread because its now a pycharm question but i do not have any edit or delete options on this page any more (for some reason) so pls just ignore my post.

(unless you know PyCharm and the answer to the code completion problem here)
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
Exclamation Integrating py script onto GUI. edwin4project 0 1,224 Oct-28-2020, 02:20 AM
Last Post: edwin4project
  Integrating code with gui.py using modular math Pleiades 0 2,251 May-02-2018, 04:02 PM
Last Post: Pleiades

Forum Jump:

User Panel Messages

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