21.12.2022 Views

python_para_desenvolvedores_2ed

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

230 Interface Gráfica

dialog.Destroy()

def on_save(self, evt):

# Salva o texto na caixa de texto

if self.fn:

file(self.fn, 'wb').write(self.control.GetLabel())

def on_exit(self, evt):

# Fecha a janela principal

self.Close(True)

def about(self, evt):

dlg = wx.MessageDialog(self,

'Exemplo wxPython', 'Sobre...',

wx.OK | wx.ICON_INFORMATION)

dlg.ShowModal()

dlg.Destroy()

app = wx.App()

frame = Main(None , wx.ID_ANY, 'Isto é quase um editor...')

frame.Show(True)

app.MainLoop()

Janela principal:

Exemplo (caixa de mensagem):

# -*- coding: latin1 -*-

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!