创建和使用菜单 的案例
import sys
from PyQt5.QtCore import Qt, QMimeData, QDate, QDateTime, QTime
from PyQt5.QtGui import QIcon, QPainter, QBrush, QPixmap
from PyQt5.QtWidgets import QApplication, QWidget, QComboBox, QFormLayout, QLabel, QLineEdit, QPushButton, QGridLayout, \
QCalendarWidget, QVBoxLayout, QDateTimeEdit, QAction, QMainWindow
'''
创建和使用菜单 的案例
'''
class MenuDemo(QMainWindow):
def __init__(self):
super().__init__()
self.initUI()
def initUI(self):
# 设置定位和左上角坐标
self.setGeometry(300, 300, 400, 360)
# 设置窗口标题
self.setWindowTitle('创建菜单和菜单的使用 的演示')
# 设置窗口图标
# self.setWindowIcon(QIcon('../web.ico'))
# 获取菜单
bar = self.menuBar()
file = bar.addMenu('文件')