Pyqt5 help
Barry Scott
barry at barrys-emacs.org
Sat Feb 1 11:41:22 EST 2020
> On 1 Feb 2020, at 12:06, Souvik Dutta <souvik.viksou at gmail.com> wrote:
>
> I was making a pyqt5 project and I ran into a problem. I want a button in
> one window to add a label in another window when clicked upon. But that is
> not happening. Now the no. Of labels depend upon something, so I decided to
> use a for loop which is not working. Attaching the code below. Can you help?
> <birthdayapp.txt>--
> https://mail.python.org/mailman/listinfo/python-list <https://mail.python.org/mailman/listinfo/python-list>
I just read the code, did not run it.
The file should have .py as the extension not .txt.
In python3 its super().__init__ no need for the args.
I cannot see you calling setCentralWidget() so nothing will be drawn.
If you expect to show more then 1 Widget you will have to use
layout widgets. Here is the ref to the Qt docs on layouts.
https://doc.qt.io/qt-5/examples-layouts.html <https://doc.qt.io/qt-5/examples-layouts.html>
A blank line before each def would make the code easier to read.
Barry
More information about the Python-list
mailing list