Python - popup menu in wxPython Last Updated : 24 Feb, 2023 Summarize Comments Improve Suggest changes Share Like Article Like Report In this article we are going to know how can we create a popupmenu in wxPython. We will write a code when we click right on screen a popup menu will show up with menu items names as 'one' and 'two'. Syntax : wx.Window.PopupMenu(self, menu, pos) Parameters : ParameterInput TypeDescriptionmenuwx.MenuMenu in popupmenu.pointwx.Pointpoint of popup menu. Code Example : Python3 import wx class PopMenu(wx.Menu): def __init__(self, parent): super(PopMenu, self).__init__() self.parent = parent # menu item 1 popmenu = wx.MenuItem(self, wx.NewId(), 'one ') self.Append(popmenu) # menu item 2 popmenu2 = wx.MenuItem(self, wx.NewId(), 'two') self.Append(popmenu2) class Example(wx.Frame): def __init__(self, *args, **kwargs): super(Example, self).__init__(*args, **kwargs) self.InitUI() def InitUI(self): self.Bind(wx.EVT_RIGHT_DOWN, self.OnRightDown) self.SetSize((600, 400)) self.SetTitle('Popup Menu') self.Centre() def OnRightDown(self, e): # show popup menu self.PopupMenu(PopMenu(self), e.GetPosition()) def main(): app = wx.App() ex = Example(None) ex.Show() app.MainLoop() if __name__ == '__main__': main() Output : Comment More infoAdvertise with us Next Article Button in wxPython - Python R RahulSabharwal Follow Improve Article Tags : Python Python-gui Python-wxPython Practice Tags : python Similar Reads Python - MenuBars in wxPython One of the most important part in a GUI is a menubar, which are used to perform various operations on a Window. In this article we will learn how to create a menubar and add menu item to it. This can be achieved using MenuBar() constructor and Append() function in wx.MenuBar class. Syntax for MenuBa 1 min read Python - GetMenu() function in wxPython In this particular article we are going to learn about GetMenu() function of wx.MenuBar class of wxPython. GetMenu() is function in wx.MenuBar class that return wx.Menu object present in Menubar. It needs only index of menu present on menubar. Syntax : wx.MenuBar.GetMenu(self, menuindex) Parameters 1 min read wxPython - Image on button in Python In this particular article we will learn how can we add image to a button in GUI using wxPython. This can be achieved using BitmapButton() constructor of wx.BitmapButton class in wx. Following Window Styles are supported : wx.BU_LEFT: Left-justifies the bitmap label.wx.BU_TOP: Aligns the bitmap labe 1 min read Python - Move() function in wxPython In this particular article we will learn, how can we move our window to a particular point. This can be achieved using Move() function in wx.Window class of wxPython. Move() takes x and y points to move window to a particularx, y point. Syntax : wx.Move(self, x, y, flags=SIZE_USE_EXISTING) Parameter 1 min read Button in wxPython - Python In this article we are going to learn how can we add buttons to a frame in wxPython. This can be done by using the Button() constructor of wx.Button class. Following styles are supported in this class: wx.BU_LEFT: Left-justifies the label. Windows and GTK+ only.wx.BU_TOP: Aligns the label to the top 2 min read Python | wxPython module Introduction Python provides wxpython module which allows us to create high functional graphical user interface. It is an Open Source module, which means it is free for anyone to use and the source code is available for anyone to look and modify. It is implemented as a set of extension modules that wrap the GUI 3 min read Like