Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PYTHON

menubar pyqt

menubar = self.menuBar() # create our menubar
file = menubar.addMenu("&File") # create a file menu
open = QAction("&Open", self) # create a QAction
open.setShortcut("Ctrl+O") # set a shortcut for it
file.addAction(open) # and add it to our menu

# create another one and add it again to our menu
save = QAction("&Save",self) 
save.setShortcut("Ctrl+S")
file.addAction(save)

# and if you want to connect your QActions to your slots you can do it like:
open.triggered.connect(lambda: self.yourfunction())
 
PREVIOUS NEXT
Tagged: #menubar #pyqt
ADD COMMENT
Topic
Name
9+7 =