Python Forum
[PyQt] Size Policy, Laout and Official Documentation
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
[PyQt] Size Policy, Laout and Official Documentation
#4
Another example is this:

from PyQt5 import QtWidgets

app = QtWidgets.QApplication([])
window = QtWidgets.QWidget()
window.setGeometry(50, 50, 500, 300)
menu_bar = QtWidgets.QMenuBar(window)
menu_bar.setGeometry(0, 0, 500, 22)
size_policy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.Fixed)
menu_bar.setSizePolicy(size_policy)
menu_bar.addMenu("File")
menu_bar.addMenu("Edit")
lay = QtWidgets.QHBoxLayout()
lay.addWidget(menu_bar)
window.setLayout(lay)
window.show()
app.exec()
If we remove the QVBoxLayout the sizepolicy is not working. Strange!
Reply


Messages In This Thread
RE: Size Policy, Laout and Official Documentation - by Man_from_India - Jul-13-2019, 11:47 AM

Possibly Related Threads…
Thread Author Replies Views Last Post
  [Tkinter] Trying to change font size w/o changing button size python63 3 13,019 Aug-05-2020, 01:04 AM
Last Post: Larz60+
  PyGtk3 why is Locale Folder Size Half of Module Size ? harun2525 1 4,390 Mar-09-2017, 03:46 AM
Last Post: Analyser

Forum Jump:

User Panel Messages

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