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.

Interface Gráfica 227

Exemplo (temporizador):

# -*- coding: latin1 -*-

import wx

import time

class Main(wx.Frame):

def __init__(self, parent, id, title):

wx.Frame.__init__(self, parent, id, title, size=(150, 80))

clock = time.asctime().split()[3]

# Cria um rótulo de texto

self.control = wx.StaticText(self, label=clock)

# Muda a fonte

self.control.SetFont(wx.Font(22, wx.SWISS, wx.NORMAL, wx.BOLD))

# Cria um timer

TIMER_ID = 100

self.timer = wx.Timer(self, TIMER_ID)

# Inicia o timer

self.timer.Start(1000)

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

Saved successfully!

Ooh no, something went wrong!