mirror of
https://github.com/wxWidgets/Phoenix.git
synced 2026-01-27 14:10:07 +01:00
⁉️ Not sure if the generated .rst stuff is intended to have
whitespace like this in it or not, so seperating this from the other
commits, so easy to revert if necessary.
37 lines
918 B
Python
37 lines
918 B
Python
##Andrea Gavana
|
|
#!/usr/bin/env python
|
|
|
|
# This sample shows a simple example of how to use the
|
|
# "Bind" method to handle an event
|
|
|
|
import wx
|
|
|
|
class MainWindow(wx.Frame):
|
|
|
|
def __init__(self, parent, title):
|
|
|
|
wx.Frame.__init__(self, parent, title=title)
|
|
|
|
# Bind the "close window" event to the OnClose handler
|
|
self.Bind(wx.EVT_CLOSE, self.OnClose)
|
|
|
|
self.Show()
|
|
|
|
|
|
def OnClose(self, event):
|
|
|
|
# This displays a message box asking the user to confirm
|
|
# she wants to quit the application
|
|
dlg = wx.MessageDialog(self, 'Are you sure you want to quit?', 'Question',
|
|
wx.YES_NO | wx.NO_DEFAULT | wx.ICON_QUESTION)
|
|
|
|
if dlg.ShowModal() == wx.ID_YES:
|
|
self.Destroy()
|
|
else:
|
|
event.Veto()
|
|
|
|
|
|
app = wx.App(False)
|
|
frame = MainWindow(None, 'Bind example')
|
|
app.MainLoop()
|