Skip to content

Commit 86b1ec7

Browse files
committed
TR update: Python menus and toolbars
1 parent 37cbe24 commit 86b1ec7

File tree

3 files changed

+26
-4
lines changed

3 files changed

+26
-4
lines changed

python-menus-toolbars/MIT.txt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
The MIT License (MIT)
22

3-
Copyright (c) 2014 Prahlad Yeri
3+
Copyright (c) 2020 Leodanis Pozo Ramos
44

55
Permission is hereby granted, free of charge, to any person obtaining a copy
66
of this software and associated documentation files (the "Software"), to deal
@@ -18,4 +18,4 @@ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
1818
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
1919
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
2020
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21-
SOFTWARE.
21+
SOFTWARE.

python-menus-toolbars/README.md

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,23 @@
22

33
A sample GUI application that shows how to create and use menus, toolbars, and status bars using Python and PyQt.
44

5-
## Author
5+
## How to Run this Application
6+
7+
To run this application, you need to [install `PyQt5`](https://realpython.com/python-pyqt-gui-calculator/#installing-pyqt) on your Python environment. To do that, you can run the following commands in a terminal or command prompt:
8+
9+
```sh
10+
$ pip3 install PyQt5
11+
```
12+
13+
Once you have [PyQt](https://www.riverbankcomputing.com/static/Docs/PyQt5/) installed, you can run the application by executing the following command:
14+
15+
```sh
16+
$ python3 sample-app.py
17+
```
18+
19+
This command will launch the application, so you'll be able to experiment with it.
20+
21+
## About the Author
622

723
Leodanis Pozo Ramos – [@lpozo78](https://twitter.com/lpozo78)[email protected]
824

python-menus-toolbars/sample-app.py

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,13 @@ def __init__(self, parent=None):
4141
self._createActions()
4242
self._createMenuBar()
4343
self._createToolBars()
44+
45+
# Uncomment the call to ._createContextMenu() below to create a context
46+
# menu using menu policies. To test this out, you also need to
47+
# comment .contextMenuEvent() and uncomment ._createContextMenu()
48+
4449
# self._createContextMenu()
50+
4551
self._connectActions()
4652
self._createStatusBar()
4753

@@ -128,7 +134,7 @@ def _createActions(self):
128134
self.helpContentAction = QAction("&Help Content...", self)
129135
self.aboutAction = QAction("&About...", self)
130136

131-
# Uncomment this method to create a context menu using menu policy
137+
# Uncomment this method to create a context menu using menu policies
132138
# def _createContextMenu(self):
133139
# # Setting contextMenuPolicy
134140
# self.centralWidget.setContextMenuPolicy(Qt.ActionsContextMenu)

0 commit comments

Comments
 (0)