Can not SetBackgroundcolour in a wxTextCtrl

How do I know if I use themes? And how do I a remove
the themes?

I am using Suse 9.0 with wxpython 2.4.1.2 (I had it wrong in my first post).

But I have also a wxpython app running on my machine that has the
background colour set in the textctrl.

···

-----Original Message-----
From: Kevin Altis [mailto:altis@semi-retired.com]
Sent: Monday, April 12, 2004 8:30 PM
To: wxPython-users@lists.wxwidgets.org
Subject: Re: [wxPython-users] Can not SetBackgroundcolour in a
wxTextCtrl

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

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

Toni Brkic wrote:

How do I know if I use themes? And how do I a remove
the themes?

Some GTK themes do not allow the widgets colours to be changed. Try removing or renaming ~/.gtkrc to find out if this is the problem.

···

--
Robin Dunn
Software Craftsman
http://wxPython.org Java give you jitters? Relax with wxPython!

I removed .gtkrc and I use kde and did this

# If you do not want KDE to override your GTK settings, select
# Appearance & Themes -> Colors in the Control Center and disable the checkbox
# "Apply colors to non-KDE applications"

···

#

but I still get that it flashes green for a moment and then
is set to white again.

The strange thing is that it works if I stat the app remotely over
ssh. So I am at work and do ssh to my home computer it works. If
copy the app to my workcomputer and start it there it doesnt work.

/Toni

Robin Dunn wrote:

Toni Brkic wrote:

How do I know if I use themes? And how do I a remove
the themes?

Some GTK themes do not allow the widgets colours to be changed. Try removing or renaming ~/.gtkrc to find out if this is the problem.

I found the problem, it is KDE that forces the colours
on the wxpython app.

I dont know how to disable it though.
I unchecked the 'Apply colors to non-KDE applications' but
is still doesnt work.

Is it possible to override default background colour?

/Toni

Toni Brkic wrote:

···

I removed .gtkrc and I use kde and did this

# If you do not want KDE to override your GTK settings, select
# Appearance & Themes -> Colors in the Control Center and disable the checkbox
# "Apply colors to non-KDE applications"
#

but I still get that it flashes green for a moment and then
is set to white again.

The strange thing is that it works if I stat the app remotely over
ssh. So I am at work and do ssh to my home computer it works. If
copy the app to my workcomputer and start it there it doesnt work.

/Toni

Robin Dunn wrote:

Toni Brkic wrote:

How do I know if I use themes? And how do I a remove
the themes?

Some GTK themes do not allow the widgets colours to be changed. Try removing or renaming ~/.gtkrc to find out if this is the problem.

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

It was that I used a theme.

What I found out in the end is
that there is an ENV variable $GTK_RC_FILES which points
to several gtkrc files. I guess that when you start an app
is that it goes through the list of files in this variable and applies
them.

So what I did was:
setenv GTK_RC_FILES ""

and now it worked.

The bad thing is that it doesnt seem that it is possible to
override the theme from wxPython. So I cant guarantee that
the textfield has another colour.

I wanted to use the textfield so that when it is not editable
it should be greyed out. Is there any other way of doing it?
For example could one hint to gtk that the textfield is inactive
and that it should use the colour for inactive??

/Toni

Toni Brkic wrote:

···

I found the problem, it is KDE that forces the colours
on the wxpython app.

I dont know how to disable it though.
I unchecked the 'Apply colors to non-KDE applications' but
is still doesnt work.

Is it possible to override default background colour?

/Toni

Toni Brkic wrote:

I removed .gtkrc and I use kde and did this

# If you do not want KDE to override your GTK settings, select
# Appearance & Themes -> Colors in the Control Center and disable the checkbox
# "Apply colors to non-KDE applications"
#

but I still get that it flashes green for a moment and then
is set to white again.

The strange thing is that it works if I stat the app remotely over
ssh. So I am at work and do ssh to my home computer it works. If
copy the app to my workcomputer and start it there it doesnt work.

/Toni

Robin Dunn wrote:

Toni Brkic wrote:

How do I know if I use themes? And how do I a remove
the themes?

Some GTK themes do not allow the widgets colours to be changed. Try removing or renaming ~/.gtkrc to find out if this is the problem.

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

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

It was that I used a theme.

What I found out in the end is
that there is an ENV variable $GTK_RC_FILES which points
to several gtkrc files. I guess that when you start an app
is that it goes through the list of files in this variable and applies
them.

So what I did was:
setenv GTK_RC_FILES ""

and now it worked.

The bad thing is that it doesnt seem that it is possible to
override the theme from wxPython. So I cant guarantee that
the textfield has another colour.

I wanted to use the textfield so that when it is not editable
it should be greyed out. Is there any other way of doing it?

textfield.Enable(False) works for me

···

On Tue, 2004-04-13 at 15:35, Toni Brkic wrote:

For example could one hint to gtk that the textfield is inactive
and that it should use the colour for inactive??

/Toni

Toni Brkic wrote:
> I found the problem, it is KDE that forces the colours
> on the wxpython app.
>
> I dont know how to disable it though.
> I unchecked the 'Apply colors to non-KDE applications' but
> is still doesnt work.
>
>
> Is it possible to override default background colour?
>
>
> /Toni
>
> Toni Brkic wrote:
>
>> I removed .gtkrc and I use kde and did this
>>
>> # If you do not want KDE to override your GTK settings, select
>> # Appearance & Themes -> Colors in the Control Center and disable the
>> checkbox
>> # "Apply colors to non-KDE applications"
>> #
>>
>> but I still get that it flashes green for a moment and then
>> is set to white again.
>>
>> The strange thing is that it works if I stat the app remotely over
>> ssh. So I am at work and do ssh to my home computer it works. If
>> copy the app to my workcomputer and start it there it doesnt work.
>>
>> /Toni
>>
>>
>>
>> Robin Dunn wrote:
>>
>>> Toni Brkic wrote:
>>>
>>>> How do I know if I use themes? And how do I a remove
>>>> the themes?
>>>
>>>
>>>
>>>
>>> Some GTK themes do not allow the widgets colours to be changed. Try
>>> removing or renaming ~/.gtkrc to find out if this is the problem.
>>>
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: wxPython-users-unsubscribe@lists.wxwidgets.org
>> For additional commands, e-mail: wxPython-users-help@lists.wxwidgets.org
>>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: wxPython-users-unsubscribe@lists.wxwidgets.org
> For additional commands, e-mail: wxPython-users-help@lists.wxwidgets.org
>

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

--
thys

--

The information contained in this communication is confidential and may be
legally privileged. It is solely for use of the individual or entity to whom
is addressed and others authorised to receive it. If you are not the intended
recipient you are hereby notified that any disclosure, copying, distribution
or taking of any action in reliance on the contents of this information is
strictly prohibited and may be unlawful.

This Message has been scanned for viruses and dangerous content by the NetSys
International Mail Scanner and is believed to be clean.

Thys Meintjes wrote:

···

On Tue, 2004-04-13 at 15:35, Toni Brkic wrote:

It was that I used a theme.

What I found out in the end is
that there is an ENV variable $GTK_RC_FILES which points
to several gtkrc files. I guess that when you start an app
is that it goes through the list of files in this variable and applies
them.

So what I did was:
setenv GTK_RC_FILES ""

and now it worked.

The bad thing is that it doesnt seem that it is possible to
override the theme from wxPython. So I cant guarantee that
the textfield has another colour.

I wanted to use the textfield so that when it is not editable
it should be greyed out. Is there any other way of doing it?

textfield.Enable(False) works for me

Thanks alot,
exactly what I was looking for.

/Toni