本文整理汇总了Python中PyQt5.QtWidgets.QWidget.height方法的典型用法代码示例。如果您正苦于以下问题:Python QWidget.height方法的具体用法?Python QWidget.height怎么用?Python QWidget.height使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PyQt5.QtWidgets.QWidget
的用法示例。
在下文中一共展示了QWidget.height方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: AboutWdiget
# 需要导入模块: from PyQt5.QtWidgets import QWidget [as 别名]
# 或者: from PyQt5.QtWidgets.QWidget import height [as 别名]
class AboutWdiget(Ui_AboutForm):
def __init__(self):
super().__init__()
self.about_widget = QWidget()
self.setupUi(self.about_widget)
self.about_widget.setFixedSize(self.about_widget.width(),self.about_widget.height())
self.set_version()
self.label_info.setOpenExternalLinks(True)
def set_version(self):
self.label_version.setText('Version ' + mconfig.version)
示例2: QPushButton
# 需要导入模块: from PyQt5.QtWidgets import QWidget [as 别名]
# 或者: from PyQt5.QtWidgets.QWidget import height [as 别名]
btn = QPushButton( widget )
btn.setText("Button")
#以QWidget左上角为(0, 0)点
btn.move(20, 20)
#不同操作系统可能对窗口最小宽度有规定,若设置宽度小于规定值,则会以规定值进行显示
widget.resize(300, 200)
#以屏幕左上角为(0, 0)点
widget.move(250, 200)
widget.setWindowTitle('PyQt坐标系统例子')
widget.show()
print("#1 QWidget")
print("widget.x()=%d" % widget.x() )
print("widget.y()=%d" % widget.y() )
print("widget.width()=%d" % widget.width() )
print("widget.height()=%d" % widget.height() )
print("#2 QWidget.geometry")
print("widget.geometry().x()=%d" % widget.geometry().x() )
print("widget.geometry().y()=%d" % widget.geometry().y() )
print("widget.geometry().width()=%d" % widget.geometry().width() )
print("widget.geometry().height()=%d" % widget.geometry().height() )
print("widget.size().width() =%d" % widget.size().width() )
print("widget.size().height() =%d" % widget.size().height() )
print("#3 QWidget.frameGeometry")
print("widget.frameGeometry().width()=%d" % widget.frameGeometry().width() )
print("widget.frameGeometry().height()=%d" % widget.frameGeometry().height() )
print("widget.pos().x()=%d" % widget.pos().x() )
print("widget.pos().y()=%d" % widget.pos().y() )
示例3: E5AnimatedWidget
# 需要导入模块: from PyQt5.QtWidgets import QWidget [as 别名]
# 或者: from PyQt5.QtWidgets.QWidget import height [as 别名]
class E5AnimatedWidget(QWidget):
"""
Class implementing an animated widget.
"""
DirectionDown = 0
DirectionUp = 1
def __init__(self, direction=DirectionDown, duration=300, parent=None):
"""
Constructor
@param direction direction of the animation
@type int (one of DirectionDown or DirectionUp)
@param duration duration of the animation
@type int
@param parent reference to the parent widget
@type QWidget
"""
super(E5AnimatedWidget, self).__init__(parent)
self.__direction = direction
self.__stepHeight = 0.0
self.__stepY = 0.0
self.__startY = 0
self.__widget = QWidget(self)
self.__timeline = QTimeLine(duration)
self.__timeline.setFrameRange(0, 100)
self.__timeline.frameChanged.connect(self.__animateFrame)
self.setMaximumHeight(0)
def widget(self):
"""
Public method to get a reference to the animated widget.
@return reference to the animated widget
@rtype QWidget
"""
return self.__widget
@pyqtSlot()
def startAnimation(self):
"""
Public slot to start the animation.
"""
if self.__timeline.state() == QTimeLine.Running:
return
shown = 0
hidden = 0
if self.__direction == self.DirectionDown:
shown = 0
hidden = -self.__widget.height()
self.__widget.move(QPoint(self.__widget.pos().x(), hidden))
self.__stepY = (hidden - shown) / 100.0
self.__startY = hidden
self.__stepHeight = self.__widget.height() / 100.0
self.__timeline.setDirection(QTimeLine.Forward)
self.__timeline.start()
@pyqtSlot(int)
def __animateFrame(self, frame):
"""
Private slot to animate the next frame.
@param frame frame number
@type int
"""
self.setFixedHeight(frame * self.__stepHeight)
self.__widget.move(self.pos().x(),
self.__startY - frame * self.__stepY)
@pyqtSlot()
def hide(self):
"""
Public slot to hide the animated widget.
"""
if self.__timeline.state() == QTimeLine.Running:
return
self.__timeline.setDirection(QTimeLine.Backward)
self.__timeline.finished.connect(self.close)
self.__timeline.start()
p = self.parentWidget()
if p is not None:
p.setFocus()
def resizeEvent(self, evt):
"""
Protected method to handle a resize event.
@param evt reference to the event object
@type QResizeEvent
"""
#.........这里部分代码省略.........
示例4: SIGNAL
# 需要导入模块: from PyQt5.QtWidgets import QWidget [as 别名]
# 或者: from PyQt5.QtWidgets.QWidget import height [as 别名]
exportb.clicked.connect(export)
statsb.clicked.connect(createStats)
else:
push.connect(push, SIGNAL("clicked()"), update)
plotb.connect(plotb, SIGNAL("clicked()"), plot)
toggleb.connect(toggleb, SIGNAL("clicked()"), toggle)
exportb.connect(exportb, SIGNAL("clicked()"), export)
statsb.connect(statsb, SIGNAL("clicked()"), createStats)
guiConfig = {"x": 50, "y": 50, "width": 800, "height": 500, "scrollPosition": 0}
if os.path.exists("gui_config.yml"):
with open("gui_config.yml") as f:
guiConfig.update(yaml.load(f))
window.setGeometry(guiConfig["x"], guiConfig["y"], guiConfig["width"], guiConfig["height"])
area.verticalScrollBar().setValue(guiConfig["scrollPosition"])
window.show()
r = app.exec_()
guiConfig["x"] = window.x()
guiConfig["y"] = window.y()
guiConfig["width"] = window.width()
guiConfig["height"] = window.height()
guiConfig["scrollPosition"] = area.verticalScrollBar().value()
with open("gui_config.yml", "w") as f:
f.write(yaml.dump(guiConfig))
sys.exit(r)