문제

10I'm trying to make use of GTK3+ on Windows. The setup is Python 2.7 and GTK3+ (3.10.x) installed from http://sourceforge.net/projects/pygobjectwin32/files/?source=navbar Which to me seemed like the easiest way to get it up and running, correct me if I'm wrong.

The following app works fine on Linux but on Windows the shading of the button is off and I cannot seem to change the color of the text, it just stays black.

from gi.repository import Gtk, Gdk

win = Gtk.Window()
win.set_name('MyWindow')

# The Button
button = Gtk.Button("Click Me")
win.add(button)


win.connect("delete-event", Gtk.main_quit)

style_provider = Gtk.CssProvider()

css = """
#MyWindow GtkButton {

    border-radius: 10px;
    border-color: #000;
    font: Sans 10;
    color: white;                   
    box-shadow: 0 0 5px grey inset;
    margin: 10px;
}
"""

style_provider.load_from_data(css)

Gtk.StyleContext.add_provider_for_screen(
    Gdk.Screen.get_default(), 
    style_provider,     
    Gtk.STYLE_PROVIDER_PRIORITY_APPLICATION
)

win.show_all()
Gtk.main()

Any ideas about what could be wrong here?

도움이 되었습니까?

해결책

make sure that in your settings.ini the theme Adwaita is not commented out, you can find it in C:\Python27\Lib\site-packages\gnome\etc\gtk-3.0 (or similar prefix depending on your installation of python)

[Settings]
gtk-theme-name = Adwaita
#gtk-font-name = Arial 10
라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top