0% found this document useful (0 votes)
18 views2 pages

Python 4

Uploaded by

yoxad22705
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
18 views2 pages

Python 4

Uploaded by

yoxad22705
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 2

import wx

if __name__ == "__main__":
app = wx.App(False)
frame = MainFrame()
frame.Show()
app.MainLoop()
if __name__ == "__main__":
app = wx.App(False)
frame = MainFrame()
frame.Show()
app.MainLoop()
if __name__ == "__main__":
app = wx.App(False)
frame = MainFrame()
frame.Show()
app.MainLoop()
if __name__ == "__main__":
app = wx.App(False)
frame = MainFrame()
frame.Show()
app.MainLoop()

class MyFrame(wx.Frame):
def __init__(self, parent, title):
super().__init__(parent, title=title, size=(300, 200))

panel = wx.Panel(self)
self.listbox = wx.ListBox(panel, pos=(20, 20), size=(120, 80))

# Botões para interagir com a ListBox


add_button = wx.Button(panel, label="Adicionar Item", pos=(150, 20))
check_button = wx.Button(panel, label="Verificar", pos=(150, 60))

add_button.Bind(wx.EVT_BUTTON, self.on_add_item)
check_button.Bind(wx.EVT_BUTTON, self.on_check_items)
if __name__ == "__main__":
app = wx.App(False)
frame = MainFrame()
frame.Show()
app.MainLoop()
def on_add_item(self, event):
self.listbox.Append("Novo Item")

def on_check_items(self, event):


if self.listbox.GetCount() > 0:
wx.MessageBox("A lista contém itens.", "Verificação")
else:
wx.MessageBox("A lista está vazia.", "Verificação")
if __name__ == "__main__":
app = wx.App(False)
frame = MainFrame()
frame.Show()
app.MainLoop()
class MyApp(wx.App):
def OnInit(self):
frame = MyFrame(None, "Exemplo wxListBox")
frame.Show()
return True

app = MyApp()
app.MainLoop()

You might also like