Pmw ScrolledText background

Chad Netzer cnetzer at mail.arc.nasa.gov
Thu Mar 27 21:13:57 CET 2003


On Wed, 2003-03-26 at 08:42, student wrote:

> I need to change the background color of a Pmw.ScrolledText widget
> 
> by default it is white ... i have the following code:

In the future, if at all possible, please post short pieces of code that
can be cut and pasted into an interpreter to show the desired effect (or
misfeature).  It will generally lead to more and faster responses.  We
are all busy people, and can't afford to spend time filling in all the
details to test non-working code.

The code you posted, once I edited it to work (importing modules,
initialization, etc.) set the background to red for me, on my Linux
system (I'm not able to easily test Windows right now).

I suspect your problem results from using a Pmw class method
(Pmw.Color.changecolor) on a Tkinter widget (text).  I use the Tkinter
wiget method configure() (on the component you extracted), to achieve
the same effect.  I believe my technique is more the more common, and
more proper, of the two.

Here is a minimal working version of the code for me.  Does it produce a
red background for you?



import Pmw
r = Pmw.initialise()
s = Pmw.ScrolledText(r)
s.pack()
s.component('text').configure(background = 'red')
r.mainloop()


-- 
Bay Area Python Interest Group - http://www.baypiggies.net/

Chad Netzer
(any opinion expressed is my own and not NASA's or my employer's)







More information about the Python-list mailing list