Foros del Web » Programando para Internet » Python »

color en textctrl

Estas en el tema de color en textctrl en el foro de Python en Foros del Web. como se hace para ponerle color al texto de un textctrl??? les agradeceria una ayudita.gracias...
  #1 (permalink)  
Antiguo 07/03/2012, 19:52
 
Fecha de Ingreso: diciembre-2010
Mensajes: 162
Antigüedad: 13 años, 4 meses
Puntos: 1
color en textctrl

como se hace para ponerle color al texto de un textctrl??? les agradeceria una ayudita.gracias
  #2 (permalink)  
Antiguo 07/03/2012, 23:47
Avatar de 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: color en textctrl

Código Python:
Ver original
  1. import wx
  2.  
  3. class F(wx.Frame):
  4.     def __init__(self, *args, **kw):
  5.         wx.Frame.__init__(self, None)
  6.         style = wx.TE_MULTILINE|wx.BORDER_SUNKEN|wx.TE_READONLY|wx.TE_RICH2
  7.         self.status_area = wx.TextCtrl(self, -1,
  8.                                        pos=(10, 270),style=style,
  9.                                        size=(380,150))
  10.         self.status_area.AppendText("blahblahhblah")
  11.         fg = wx.Colour(200,80,100)
  12.         at = wx.TextAttr(fg)
  13.         self.status_area.SetStyle(3, 5, at)
  14.  
  15. app = wx.PySimpleApp()
  16. f = F()
  17. f.Show()
  18. app.MainLoop()

Ejemplo sacado de aquí.
  #3 (permalink)  
Antiguo 08/03/2012, 22:08
 
Fecha de Ingreso: diciembre-2010
Mensajes: 162
Antigüedad: 13 años, 4 meses
Puntos: 1
Respuesta: color en textctrl

gracias por la respuesta y si quiero que al escribir una palabra cualkiera el texto de esa palabra se ponga de un color como hago???? lo he intentado y no me sale de ninguna forma.
  #4 (permalink)  
Antiguo 08/03/2012, 23:01
Avatar de 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: color en textctrl

Código Python:
Ver original
  1. import wx
  2.  
  3. class F(wx.Frame):
  4.     def __init__(self, *args, **kw):
  5.         wx.Frame.__init__(self, None)
  6.         style = wx.TE_MULTILINE|wx.BORDER_SUNKEN|wx.TE_RICH2
  7.         fg = wx.Colour(255,0,0)
  8.         self.status_area = wx.TextCtrl(self, -1,
  9.                                        pos=(10, 270),style=style,
  10.                                        size=(380,150))
  11.         self.status_area.SetForegroundColour(fg)
  12.         self.status_area.AppendText("blahblahhblah")
  13.  
  14. app = wx.PySimpleApp()
  15. f = F()
  16. f.Show()
  17. app.MainLoop()

Etiquetas: color
Atención: Estás leyendo un tema que no tiene actividad desde hace más de 6 MESES, te recomendamos abrir un Nuevo tema en lugar de responder al actual.
Respuesta




La zona horaria es GMT -6. Ahora son las 03:26.