First time here? Check out the FAQ!
1

Create GUI with PyQT5 on Wing Personal

I am beginning in python and have made some non GUI samples and they tested good on Wing Personal. I have a sample GUI to test that tested good in a different build system. The sample was designed on QT Designer and the .ui file was converted to .py with a console script command. It is loaded in Wing Personal and there are no errors so far with it just sitting there. I ran it with the debug menu with no errors, but a GUI was not created. I have Qt Core and PyQt5 installed. I'm using Python 3.8 and have set the executable command line to /usr/local/bin/python3 (Python Launcher showed me this) and the python path to default in project properties. I have MacOS X 10.15.2 Catalina.

Should Qt Core and PyQt5 be in a special folder? (I saw Tcl/Tk in a particular 3.8 folder near some Python items.)

Is it possible to launch a GUI right out of Wing?

Is there a book or tutorial available that describes how to build GUIs with Wing and PyQt5?

Thanks for your time.

py101

py101's avatar
26
py101
asked 2020-07-18 16:15:12 -0500
Wingware Support's avatar
4.1k
Wingware Support
updated 2020-07-20 09:09:59 -0500
edit flag offensive 0 remove flag close merge delete

Comments

Can you run your code with /usr/local/bin/python3 on the command line outside of Wing and does a GUI show up? Wing should function the same as that, so yes it's possible to write GUI code in Wing (we write Wing with itself and it also uses PyQt5). From the description I'm wondering if your main entry point is missing or not set up right in your code but I'm just guessing since you didn't also post the code. You could try Step Into to get to the first line and then step through to see where it's going and whether it's executing the code that should initialize Qt and the GUI.

Wingware Support's avatar Wingware Support (2020-07-20 09:13:20 -0500) edit
add a comment see more comments

1 Answer

0

It all works now. Thanks! It was just beginner issues. I took your advice and went to /usr/local/bin/python3 and pasted the .py file there and then ran it from that folder from a terminal window I opened up at that folder. I used someone else's code that tested good on their different system, but it was not text formatted properly and I had to make some changes. I had been getting indentation, syntax, and missing file errors and worked through them all with Wing IDE. Wing IDE has a good debugger. Thanks. I didn't know indentation was that much of an issue, but read that it is important in Python. The .py code is referencing the .ui code and I don't know if it is done differently elsewhere, but that is what worked for me.

This is at the top of the .py file:

import sys from PyQt5.QtWidgets import QMainWindow, QApplication from PyQt5 import uic

Ui_MainWindow, QtBaseClass = uic.loadUiType("Test.ui")

My workspace had the Test.py and Test.ui files together and when I finally ran the .py from Wing the GUI app leapt off the IDE. I put both .py and .ui files at /usr/local/bin/python3, also. I then ran it from the terminal at /usr/local/bin/python3 and it worked there, too. I wrote all this so someone else might find it useful. Thanks again for the advice. I am very happy.

py101's avatar
26
py101
answered 2020-07-20 14:22:40 -0500, updated 2020-07-20 14:25:47 -0500
edit flag offensive 0 remove flag delete link

Comments

Great, I'm glad you got it working!

Wingware Support's avatar Wingware Support (2020-07-20 14:25:07 -0500) edit
add a comment see more comments

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account. This space is reserved only for answers. If you would like to engage in a discussion, please instead post a comment under the question or an answer that you would like to discuss.

Add Answer