Can not SetBackgroundcolour in a wxTextCtrl

Hi,

I cant manage to set the background colour in wxTextCtrl.
I have made the smallest app possible that shows my problem.
If you run the code the text_ctrl is still white even
though I have done SetBackgroundColour on the text ctrl.

I have also tried with Refresh after setting the background.

Does anybody have an idea. I am quite sure it works, since
I've seen wxPython apps that does it.

I am using wxPython 2.4.2.4 on Linux.

Best regards,

Toni

----------------Code------------------

#!/usr/bin/env python
# generated by wxGlade 0.3.2 on Mon Apr 12 17:37:26 2004

import wx

class MyFrame(wx.Frame):
    def __init__(self, *args, **kwds):
        # begin wxGlade: MyFrame.__init__
        kwds["style"] = wx.DEFAULT_FRAME_STYLE
        wx.Frame.__init__(self, None, -1, "")
        self.text_ctrl_2 = wx.TextCtrl(self, -1, "")

        self.__set_properties()
        self.__do_layout()
        # end wxGlade

    def __set_properties(self):
        # begin wxGlade: MyFrame.__set_properties
        self.SetTitle("frame_1")
        self.text_ctrl_2.SetBackgroundColour(wx.Colour(48, 252, 104))
        # end wxGlade

    def __do_layout(self):
        # begin wxGlade: MyFrame.__do_layout
        sizer_8 = wx.BoxSizer(wx.VERTICAL)
        sizer_8.Add(self.text_ctrl_2, 0, 0, 0)
        self.SetAutoLayout(1)
        self.SetSizer(sizer_8)
        sizer_8.Fit(self)
        sizer_8.SetSizeHints(self)
        self.Layout()
        # end wxGlade

class MyApp(wx.App):
    def OnInit(self):
        self.InitFrame()
        self.InitEverythingElse()
        return True

    def InitFrame(self):
        self.frame = MyFrame(None)

    def InitEverythingElse(self):
        self.frame.Show(1)
        self.SetTopWindow(self.frame)

def main():
    app = MyApp(0)
    app.MainLoop()

if __name__ == '__main__':
    main()

---------------End Code----------------

Are you using themes?

ka

···

On Apr 12, 2004, at 10:21 AM, Toni Brkic wrote:

Hi,

I cant manage to set the background colour in wxTextCtrl.
I have made the smallest app possible that shows my problem.
If you run the code the text_ctrl is still white even
though I have done SetBackgroundColour on the text ctrl.

I have also tried with Refresh after setting the background.

Does anybody have an idea. I am quite sure it works, since
I've seen wxPython apps that does it.

I am using wxPython 2.4.2.4 on Linux.

Best regards,

Toni

----------------Code------------------

#!/usr/bin/env python
# generated by wxGlade 0.3.2 on Mon Apr 12 17:37:26 2004

import wx

class MyFrame(wx.Frame):
    def __init__(self, *args, **kwds):
        # begin wxGlade: MyFrame.__init__
        kwds["style"] = wx.DEFAULT_FRAME_STYLE
        wx.Frame.__init__(self, None, -1, "")
        self.text_ctrl_2 = wx.TextCtrl(self, -1, "")

        self.__set_properties()
        self.__do_layout()
        # end wxGlade

    def __set_properties(self):
        # begin wxGlade: MyFrame.__set_properties
        self.SetTitle("frame_1")
        self.text_ctrl_2.SetBackgroundColour(wx.Colour(48, 252, 104))
        # end wxGlade

    def __do_layout(self):
        # begin wxGlade: MyFrame.__do_layout
        sizer_8 = wx.BoxSizer(wx.VERTICAL)
        sizer_8.Add(self.text_ctrl_2, 0, 0, 0)
        self.SetAutoLayout(1)
        self.SetSizer(sizer_8)
        sizer_8.Fit(self)
        sizer_8.SetSizeHints(self)
        self.Layout()
        # end wxGlade

class MyApp(wx.App):
    def OnInit(self):
        self.InitFrame()
        self.InitEverythingElse()
        return True

    def InitFrame(self):
        self.frame = MyFrame(None)

    def InitEverythingElse(self):
        self.frame.Show(1)
        self.SetTopWindow(self.frame)

def main():
    app = MyApp(0)
    app.MainLoop()

if __name__ == '__main__':
    main()

---------------End Code----------------

---------------------------------------------------------------------
To unsubscribe, e-mail: wxPython-users-unsubscribe@lists.wxwidgets.org
For additional commands, e-mail: wxPython-users-help@lists.wxwidgets.org