PyQt5显示一个空白的窗口

效果如下图:

 

 1 """
 2 In this example, we create a simple
 3 window in PyQt5.
 4 """
 5 
 6 # provide the necessary imports.
 7 # The basic widgets are located in PyQt5.QtWidgets module
 8 import sys
 9 from PyQt5.QtWidgets import QApplication, QWidget
10 
11 if __name__ == '__main__':
12 
13     app = QApplication(sys.argv)  # create an application object
14     w = QWidget()  # The QWidget widget is the base class of all user interface objects
15     w.resize(250, 150)  # The resize() method resizes the widget
16     w.move(300, 300)  # The move() method moves the widget to a position on the screen
17     w.setWindowTitle('Simple')  # set the title of the window with setWindowTitle()
18     w.show()  # The show() method displays the widget on the screen
19     sys.exit(app.exec_())  # The sys.exit() method ensures a clean exit

 

 

转载于:https://www.cnblogs.com/fuqia/p/8696764.html

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值