ChatCrawlersearch across public Telegram Open the app
Q

Qt for Python (PySide/Shiboken)

17 June 2020
2020-06-17×
17 June 2020
J
Jimtext not yet in the index
Some more things about it. reading file form qrc like this has some encoding issues on Windows. It's the better using QTextStream: file = QFile(path) if file.open(QFile.ReadOnly): out = QTextStream(file) return out.readAll()I wanted to add it to wiki, but it seems there no "tips and tricks" section. The FAQ seems to refer to more general things.
I
Guys, there is something i don't understand. I created a separate widget and tried to import and initialize it in mu mainwindow file. It works fine but when i delete the .show() method in my widget file, it still shows up in my mainwindow. Why is that?
C
can you send some snippets? if it's too much code, maybe use pastebin or somethng
I
It's pyqt btw, is that ok?
C
but maybe this is a general problem
C
so that's why you can maybe share some lines of the constructor or your widget and show how you are adding it to the mainwindow
I
When i delete the .show() method in the QWidget file, it still shows up in the MainWindow
C
when you remove the show() from Widget
I
When we delete it the qwidget file wont show anything after execution
C
go one step back, if I do a QWidget() that inside has a QLabel() and then I show the Widget, it will show the Label, because is part of the layout.
because you are adding widgets to the layout of what you are showing
if you want, you can 'hide()' the widget
if you have a StackedWidget, you just need to change the current widget
there is a method called setCurrentWidget
in that way you can change which one you are displaying
C
because you should not destroy widgets inside the QStackedLayout
Rarely you will need to 'destroy widgets' when using Qt, for simple applications.
C
be careful with that, since the ownership enters into the whole scenario
I
So which one is a better practice to do? SetCurrentWidget or setCurrentIndex?
if you prefer the index, it's totally fine
out of curiosity, Why you use PyQt5 and not PySide2? I just want to know what's missing in PySide2 that made you choose PyQt5
C
even if you are too lazy to change the imports, is a valid answer :P I'm really curious
Cristián 🥑out of curiosity, Why you use PyQt5 and not PySide2? I just want to know what's missing in PySide2 that made you choose PyQt5
After learning Python basics, i started looking for a platform to create desktop GUI applications, tkinter came as a built- in one but i needed a better and more powerfull option. After searching online, the top results were PyQt. I know they differ mostly in licenses and such things and they both are a Qt binding but i chose pyqt because i did not know pyside even exists (maybe pyside is not as well known as pyqt because a fast search for a python GUI framework results in pyqt and not pyside)
I
Also most tutorials online are titled as Pyqt... If i'm not mistaken
that's true, since PyQt has been out since 1991 IIRC
C
Thanks for the feedback ;)
I
Thank you too for your help 🙏
Like, there are missing articles on blogs or so. Tutorials, Videos, training courses and that like
When I was looking for a GUI toolkit, other Pythonistas reminded me on the dual-license of Qt.
Should be fine for FLOSS software, though.
A
AFAIK, compared to GTK3, Qt works better cross-platform (that's my hope, at least)
but with a diff license
that's why it doesn't get a lot of attention
that's why we are focusing at the moment in the interoperability with C++
to port Qt C++ widgets to python
C
or making C++ applications scriptable with Python
Can't tell about others, but I try to use software „from the source” if possible. Instead of a community rebuild. So you would have the advantage of being official.
Similar in the Node.js world with npm and yarn. (okay, both not affiliated with node foundation …)
Sadly, you can't use the name „Qt” in „PyQt” anymore …
A
At least not without legal fuss about trademark etc.
is because the folk at PyQt didn't want to join the Qt project
because he has his own business model
so PySide was more like a response from the Qt project
C
and since then, it all has been playing catch
Ë
I didn't ever get into PyQt. My company was more keen of PySide so I learned that and to be honest: It felt much more open and welcoming from the beginning. More so with the Qt for Python thing making it an official thing! :)
Calendar: June 2020
Archive by month
Open in Telegram Каталог площадок Искать в ChatCrawler

A snapshot of an open public feed from the search index ChatCrawler — “Google for public Telegram”; refreshed as the venue is crawled. Times are UTC.

Public content only, official Telegram API. About · FAQ · What we do not do · Remove a page · Catalog