Search
 
SCRIPT & CODE EXAMPLE
 

PYTHON

qmenu get item value python

import sys
from PyQt5.QtWidgets import *


class Window(QWidget):
    def __init__(self):
        super(Window, self).__init__()
        layout = QGridLayout(self)
        self.menu_bar = QMenuBar()
        self.menu = QMenu('MENU', self)

        self.menu_action = QAction('Option #1', self)
        self.menu_action.setData('option1')
        self.menu_action.triggered.connect(self.actionClicked)

        self.menu.addAction(self.menu_action)
        self.menu_bar.addMenu(self.menu)
        layout.addWidget(self.menu_bar)

    def actionClicked(self, checked):
        action = self.sender()
        print(action.text())
        print(action.data())


if __name__ == '__main__':
    app = QApplication(sys.argv)
    window = Window()
    window.setGeometry(600, 100, 300, 100)
    window.show()
    sys.exit(app.exec_())
Comment

PREVIOUS NEXT
Code Example
Python :: how to put more than one file type in pysimplegui 
Python :: numpy array heaviside float values to 0 or 1 
Python :: pandas drop extension name from list of files 
Python :: payizone 
Python :: numpy multiply by inverse square root of value 
Python :: numpy empty array 
Python :: python strftime microseconds 
Python :: Keras library for CIFAR-10 dataset 
Python :: how to make a flask server in python 
Python :: .annotate unique distinct 
Python :: how to find range of dates in between two dates unsing python 
Python :: pd.merge left join 
Python :: pyspark correlation between multiple columns 
Python :: yapf ignore line 
Python :: find Carmichael number sage 
Python :: python pandas convert nan to 0 
Python :: python get script path 
Python :: python import stringio 
Python :: discord bot python on reaction 
Python :: how to cycle through panes in tmux 
Python :: print 1 thing repeatedly in 1 line python 
Python :: numpy take out elements equal to zero 
Python :: python pip fix 
Python :: Access the Response Methods and Attributes in python Show Status Code 
Python :: make text bold python 
Python :: convert time zone pandas 
Python :: how to reset a variable in python 
Python :: how to obtain the content of brackets 
Python :: send email with python 
Python :: tkinter bold text 
ADD CONTENT
Topic
Content
Source link
Name
5+9 =