ChatCrawlersearch across public Telegram Open the app
Q

Qt for Python (PySide/Shiboken)

snapshot for August 2022
‹ August 2022 ›×
30 August 2022
now, if you *dont* want the layout to automatically position them, you can call setGeometry on them. that's really not nice. :)
T
specially because you have no idea if something will be painted above or below it, when you use setGeometry.
В
2. maybe my question is not clear. Widgets in fact are positioned on a parent even if I did not call any layout methods explicitly. If a widget is positioned, there should be a layout object controlling it, shouldn't it?
F
I don't understand - if you don't want your widgets to be positioned automatically, why use a layout? That's kind of its job?
T
please show us your code, there something quite wrong on it.
tomaz canabravaplease show us your code, there something quite wrong on it.
from PyQt5.QtWidgets import QApplication, QWidget, QPushButton, QGridLayout import sys class View(QWidget): def __init__(self): super().__init__() self.initUI() def initUI(self): self.btn1 = QPushButton(self, text="very long button name") self.btn2 = QPushButton(self, text="short name") self.btn1.clicked.connect(self.pressbutton1) self.btn2.clicked.connect(self.pressbutton2) #self.grid = QGridLayout() #self.setLayout(self.grid) def pressbutton1(self): print(1, flush=True) def pressbutton2(self): print(2, flush=True) def main(): app = QApplication([]) view = View() view.show() sys.exit(app.exec()) if name == "__main__": main()
В
If I uncomment creation of a grid layout, even without addWidget calls one of the button is seen a little taller than without grid layout creation, and its pressbutton method is called. Right now pressbutton methods are not called.
T
self.grid.addWidget(self.btn1, ... )
В
My problem is most likely solved anyway, thanks a lot.
31 August 2022
C
Looking for PySide/PyQT trainers
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