Created
December 8, 2012 13:51
-
-
Save niktto/4240336 to your computer and use it in GitHub Desktop.
sample of css gtk styling for hover
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
GtkButton.nasz_button { background-image: url('sciezka_do_img'); } | |
GtkButton.nasz_button:hover { background-image: url('sciezka_do_innego_img'); } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from gi.repository import Gtk, Gio | |
def main(): | |
window = Gtk.Window() | |
random_button = Gtk.Button('Przycisk') | |
random_button.show() | |
window.add(random_button) | |
styler = Gtk.CssProvider() | |
css_file = Gio.file_new_for_path('style.css') | |
styler.load_from_file(css_file) # Da sie zrobic load_from_data, ale god knows how, jakis bytearray trzeba dac | |
window_context = window.get_style_context() | |
window_context.add_provider_for_screen(window.get_screen(), styler, Gtk.STYLE_PROVIDER_PRIORITY_APPLICATION) | |
random_button.get_style_context().add_class('nasz_button') # remove class tez jest, nie podnosi bledu jak nie trafi | |
# Istnieje tez mozliwosc dodania odpowiednika id dla obiektu, ale nie udalo mi sie tego zmusic do dzialania | |
window.show() | |
haha = main() | |
Gtk.main() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment