实例
- 创建基于Dialog without Buttons模板窗口
- 拖入Tab Widget部件
- 右击Tab 2,插入页,在当前页之后
- 设定Tab的text为Product Listing,Payment Method,Delivery Address
- 在第一个Tab页添加四个CheckBox部件
- 设定CheckBox的text分别为Cell Phone $150, Laptop $500, Camera $250, Shoes $200
- 添加一个Push Button,其text为Add to Cart
- 在第二个Tab页添加四个text为Debit Card, Credit Card, Net Banking, Cash On Delivery的radio部件
- 在第三个Tab页添加六个Label,其text为 Address 1, Address 2, State, Country, Zip Code, and Contact Number
- 添加六个Line Edit部件
- 保存为demoTabWidget.ui
- 使用pyuic生成demoTabWidget.py
- 创建callTabWidget.py,其代码如下
import sys
from PyQt5.QtWidgets import QDialog,QApplication
from cookbook_200502.demoTabWidget import *
class MyForm(QDialog):
def __init__(self):
super().__init__()
self.ui=Ui_Dialog()
self.ui.setupUi(self)
self.show()
if __name__=="__main__":
app=QApplication(sys.argv)
w=MyForm()
w.show()
sys.exit(app.exec())