---
# System prepended metadata

title: Menus & toolbars
tags: [wxPython]

---

Menus & toolbars
===

## **Simple menu** 

若選單沒有正常顯示，將`wx.ID_EXIT`改成`APP_EXIT`，並在全域`APP_EXIT = 1`再執行一次試試

```python
Icons and shortcutfileItem = fileMenu.Append(wx.ID_EXIT, 'Quit', 'Quit application')
```

### APP\_EXSubmenus and separators

若選單沒有正常顯示，將`wx.ID_EXIT`改成`APP_EXIT`，並在全域`APP_EXIT = 1`再執行一次試試

```python
qmi = wx.MenuItem(fileMenu, wx.ID_EXIT, '&Quit\tCtrl+W')
```

畫出分隔線：

```python
fileMenu.AppendSeparator()
```

![](https://i.imgur.com/YaHCeOv.png)


![](https://i.imgur.com/2Uggt8J.png)


### Ref.

[Menus and toolbars](http://puremonkey2010.blogspot.com/2019/04/python-wxpython-menus-and-toolbars.html)


[https://zetcode.com/wxpython/menustoolbars/](https://zetcode.com/wxpython/menustoolbars/)

[https://www.cnblogs.com/Twobox/p/7399871.html](https://www.cnblogs.com/Twobox/p/7399871.html)







###### tags: `wxPython`