Ver Mensaje Individual
  #5 (permalink)  
Antiguo 02/04/2011, 19:01
Avatar de razpeitia
razpeitia
Moderador
 
Fecha de Ingreso: marzo-2005
Ubicación: Monterrey, México
Mensajes: 7.321
Antigüedad: 19 años, 1 mes
Puntos: 1360
Respuesta: Parpadeos o Señales acústicas en WxPython

Código Python:
Ver original
  1. import wx
  2. from time import sleep
  3.  
  4. class MyFrame(wx.Frame):
  5.     def __init__(self, parent,id, title):
  6.         wx.Frame.__init__(self, parent,id, title,size=(700,700))
  7.         self.Panel = Panel(self)
  8.         self.Show()        
  9.        
  10.  
  11. class Panel(wx.Panel):
  12.     def __init__(self, *args, **kwargs):
  13.         wx.Panel.__init__(self, *args, **kwargs)
  14.        
  15.         box = wx.BoxSizer(wx.VERTICAL)
  16.        
  17.         box1 = wx.BoxSizer(wx.HORIZONTAL)
  18.         self.txt1 = wx.TextCtrl(self)
  19.         self.lbl1 = wx.StaticText(self, label='x:  ')
  20.         box1.Add(self.lbl1)
  21.         box1.Add(self.txt1)
  22.        
  23.         box.Add(box1)
  24.         self.bttn = wx.Button(self, label='Click me')
  25.         box.Add(self.bttn)
  26.        
  27.         self.SetAutoLayout(True)
  28.         self.SetSizer(box)
  29.         self.Layout()
  30.        
  31.         self.bttn.Bind(wx.EVT_BUTTON, self.OnClick)
  32.    
  33.     def OnClick(self, event):
  34.         self.txt1.SetBackgroundColour(wx.Colour(255, 0, 0))
  35.         self.Refresh(False)
  36.            
  37.        
  38.        
  39.  
  40. app = wx.App(0)
  41. f = MyFrame(None,-1,"hola")
  42. app.MainLoop()
Espero que esto te ayuda.