Bug 963571

Summary: pygtk lost colors on buttons
Product: [Fedora] Fedora Reporter: Jos de Kloe <josdekloe>
Component: pygtk2Assignee: leigh scott <leigh123linux>
Status: CLOSED WORKSFORME QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: 21CC: walters
Target Milestone: ---   
Target Release: ---   
Hardware: x86_64   
OS: Linux   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2015-05-29 23:08:40 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Attachments:
Description Flags
a script to test button coloring
none
screenshot of it working
none
working example none

Description Jos de Kloe 2013-05-16 07:34:42 UTC
Created attachment 748629 [details]
a script to test button coloring

Description of problem:

on my current system all colors on gtk buttons are gone for GUI created from python.
On the other hand buttons in GUI created using tkinter from python seem to take their colors as expected, so it doesn't seem to be a problem in my graphics system or drivers.

Version-Release number of selected component (if applicable):

pygtk2-2.24.0-5.fc18.x86_64
python-2.7.3-13.fc18.x86_64

How reproducible:

always

Steps to Reproduce:
1.run the attached python script
2.hover the mouse over the test button
3.click the quit button to quit

Actual results:
after starting the script both buttons appear with the default gray color
and hovering the mouse over the test button does not change its color

Expected results:
at startup the test button should have a green color, the quit button should have a red color
When moving the mouse over the test button, the color of the button should change from green to red

Additional info:

Comment 1 Jos de Kloe 2013-05-31 08:21:51 UTC
I see the same issue now on another machine running F18.
Software versions here are the same but this one has a recent nvidia proprietary driver installed in stead of the nouveau driver (which was used for the machine mentioned in the above report of 16-May). Not sure if this is relevant, but just for completeness I'll report it anyway.

Comment 2 Jos de Kloe 2013-07-10 20:50:32 UTC
problem persists on Fedora 19 with software versions:
pygtk2-2.24.0-7.fc19.x86_64
python-2.7.5-1.fc19.x86_64

Comment 3 Jos de Kloe 2014-01-02 19:40:37 UTC
Still the same issue in Fedora 20 with software versions:

pygtk2-2.24.0-8.fc20.x86_64
python-2.7.5-9.fc20.x86_64

Comment 4 Fedora Admin XMLRPC Client 2014-12-06 15:43:49 UTC
This package has changed ownership in the Fedora Package Database.  Reassigning to the new owner of this component.

Comment 5 Fedora Admin XMLRPC Client 2014-12-06 17:16:52 UTC
This package has changed ownership in the Fedora Package Database.  Reassigning to the new owner of this component.

Comment 6 Fedora End Of Life 2015-05-29 09:03:54 UTC
This message is a reminder that Fedora 20 is nearing its end of life.
Approximately 4 (four) weeks from now Fedora will stop maintaining
and issuing updates for Fedora 20. It is Fedora's policy to close all
bug reports from releases that are no longer maintained. At that time
this bug will be closed as EOL if it remains open with a Fedora  'version'
of '20'.

Package Maintainer: If you wish for this bug to remain open because you
plan to fix it in a currently maintained version, simply change the 'version' 
to a later Fedora version.

Thank you for reporting this issue and we are sorry that we were not 
able to fix it before Fedora 20 is end of life. If you would still like 
to see this bug fixed and are able to reproduce it against a later version 
of Fedora, you are encouraged  change the 'version' to a later Fedora 
version prior this bug is closed as described in the policy above.

Although we aim to fix as many bugs as possible during every release's 
lifetime, sometimes those efforts are overtaken by events. Often a 
more recent Fedora release includes newer upstream software that fixes 
bugs or makes them obsolete.

Comment 7 Jos de Kloe 2015-05-29 22:19:04 UTC
Still the same issue in Fedora 21 with software versions:

pygtk2-2.24.0-11.fc21.x86_64
python-2.7.8-9.fc21.x86_64

if you need any more details to track down this issue please ask.

Comment 8 leigh scott 2015-05-29 23:08:19 UTC
Created attachment 1032296 [details]
screenshot of it working

Works fine here

Comment 9 leigh scott 2015-05-29 23:11:10 UTC
Tested on F22 problem doesn't exist

$ inxi -S
System:    Host: localhost.localdomain Kernel: 4.0.4-301.fc22.x86_64 x86_64 (64 bit)
           Desktop: Cinnamon 2.6.4  Distro: Fedora release 22 (Twenty Two)



$ rpm -q pygtk2 python
pygtk2-2.24.0-11.fc22.x86_64
python-2.7.9-6.fc22.x86_64

Comment 10 Jos de Kloe 2015-05-30 13:45:37 UTC
So it must be a local config issue on my side. Any hints on how to test this?

Comment 11 Jos de Kloe 2015-06-04 13:14:24 UTC
Created attachment 1034715 [details]
working example

Comment 12 Jos de Kloe 2015-06-04 13:15:49 UTC
Just to record this for later readers:

The issue seems related to an api change that I totally overlooked.
On http://pygtk.org/pygtk2reference/class-gtkwidget.html the description of gtk.Widget.modify_bg states in a side note:

"modify_bg() only affects widgets that have an associated gtk.gdk.Window. Widgets that do not have an associated window include ..., gtk.Button, ... These widgets can be added to a gtk.EventBox to overcome this limitation."

Now adding and EventBox actually did not work for me at all, and also others have struggled with this. The correct solution involves modifying the style of the button as illustrated in the attached script.

See also this discussion for this method:
http://stackoverflow.com/questions/1241020/gtk-create-a-colored-regular-button