wxPython | Exit() function in wxPython (original) (raw)
Last Updated : 15 Jun, 2020
In this article we are going to learn about wx.Exit() which is a inbuilt parent function present in wxPython.Exit() function exits application after calling wx.App.OnExit .
Should only be used in an emergency: normally the top-level frame should be deleted (after deleting all other frames) to terminate the application. See wx.CloseEvent and wx.App.
Syntax:
wx.Exit()Parameters:
No parameters are required by Exit() function
Coding Example:
import
wx
class
Example(wx.Frame):
`` def
__init__(
self
,
*
args,
*
*
kwargs):
`` super
(Example,
self
).__init__(
*
args,
*
*
kwargs)
`` self
.InitUI()
`` def
InitUI(
self
):
`` self
.locale
=
wx.Locale(wx.LANGUAGE_ENGLISH)
`` self
.panel
=
wx.Panel(
self
, pos
=
(
100
,
100
), size
=
(
100
,
100
))
`` self
.btn
=
wx.Button(
self
.panel,
id
=
2
, label
=
"Exit"
, pos
=
wx.DefaultPosition, size
=
(
100
,
20
))
`` self
.Bind(wx.EVT_BUTTON,
self
.onclick,
self
.btn)
`` def
onclick(
self
, e):
`` wx.Exit()
def
main():
`` app
=
wx.App()
`` ex
=
Example(
None
)
`` ex.Show()
`` app.MainLoop()
if
__name__
=
=
'__main__'
:
`` main()
Output Window:
Similar Reads
- Python - Create() function in wxPython In this particular article we are going to learn about Create() function present in wx.Frame class. Create function is similar to Frame() constructor of wx.Frame class. Create function is used in two-step frame construction. Syntax : wx.Frame.Create(parent, id=ID_ANY, title="", pos=DefaultPosition, 1 min read
- wxPython | EnableTool() function in wxPython In this article we are going to learn about EnableTool() function of wx.ToolBar class of wxPython. It is another important function in wx.Toolbar class. EnableTool() function is used to enable or disable a particular tool in Toolbar. It takes 'enable' bool parameter which is when true enable the too 2 min read
- wxPython| FindById() function in python In this article we are going to learn a simple function that is FindById() in wx.ToolBar class of wxPython. FindById is a simple function and returns a pointer to the tool identified by id or None if no corresponding tool is found. FindById() takes only single parameter that is id of a particular to 2 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
- wxPython | FindControl() function in Python In this particular article we are going to learn about FindControl() function of wx.ToolBar class of wxPython. FindControl() function is used to returns a pointer to the control identified by id or None if no corresponding control is found. It takes only one parameter 'id'. Syntax : wx.ToolBar.FindC 2 min read
- wxPython - Replace() function in wxPython Another function in wx.MenuBar class is Replace() function. If we ever want to replace a menu from menubar we use Replace() function. It takes three main parameters that is position of menu we want to replace, menu we want to add, title of new menu. Syntax : wx.MenuBar.Replace(self, pos, menu, title 2 min read
- Python - AddCheckTool() function in wxPython In this article we are going to learn about AddCheckTool() in wx.ToolBar class of wxPython. AddCheckTool() function is used to add check tools. A checktool is a kind of toggle button. A checktool have a on and off state. Syntax : wx.ToolBar.AddCheckTool(self, toolId, label, bitmap1, bmpDisabled=Null 2 min read
- wxPython - SetBitmap() function in wxPython In this article we are going we are going to learn about SetBitmap() function associated with wx.MenuItem class of wxPython. SetBitmap() sets the bitmap for the menu item. SetBitmap must be called before the item is appended to the menu, i.e. appending the item without a bitmap and setting one later 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
- wxPython - wx.DisplaySizeMM() function in wxPython In this article we are going to learn about DisplaySizeMM() function present in wxPython. DisplaySizeMM() function is one of the parent function of wxPython. DisplaySizeMM() function is similar to the DisplaySize() function the only difference is that DisplaySizeMM() function returns dimensions in m 1 min read