Re: Gtk+ progress bar color
Thanks for your help... Yes i don't understand why gtk doesn't aloow us to do some "basic" things.. On 08-03-2017 14:52, Stefan Salewski wrote: > On Wed, 2017-03-08 at 14:18 +, Rúben Rodrigues wrote: >> I asked to the Google before, but he don't give me nothing about >> this >> :-). PRELIGHT doesn't work too.. > Yes, you are right. > > I just took this example: > > https://www.spinics.net/lists/gtk/msg00686.html > > //gcc -o simple t.c `pkg-config --libs --cflags gtk+-2.0` > #include > > gint main(gint argc,gchar *argv[]) > { >GtkWidget *window; >GtkWidget* bar; >GdkColor color; > >gtk_init (&argc,&argv); >window=gtk_window_new(GTK_WINDOW_TOPLEVEL); >bar=gtk_progress_bar_new(); >gdk_color_parse("red",&color); >gtk_widget_modify_bg(bar,GTK_STATE_NORMAL, &color); >gtk_widget_modify_bg(bar,GTK_STATE_PRELIGHT, &color); >gtk_widget_modify_bg(bar,GTK_STATE_ACTIVE, &color); >gtk_widget_modify_bg(bar,GTK_STATE_SELECTED, &color); >gtk_widget_modify_bg(bar,GTK_STATE_INSENSITIVE, &color); > >gtk_widget_modify_fg(bar,GTK_STATE_NORMAL, &color); >gtk_widget_modify_fg(bar,GTK_STATE_PRELIGHT, &color); >gtk_widget_modify_fg(bar,GTK_STATE_ACTIVE, &color); >gtk_widget_modify_fg(bar,GTK_STATE_SELECTED, &color); >gtk_widget_modify_fg(bar,GTK_STATE_INSENSITIVE, &color); > >gtk_progress_bar_set_fraction(GTK_PROGRESS_BAR(bar),0.5); >gtk_container_add(GTK_CONTAINER(window),bar); >gtk_widget_show_all (window); >gtk_main(); >return 0; > } > > And on my box the bar is still blue! > > GTK can be really hard and stubborn sometimes. > > I do not have the GTK2 source codes on my box currently, so I can not > look at it currently. Maybe Mr Bassi or someone of the other few > remaining GTK insiders is still following this thread. At least now > your real goal is clear and we have tried it ourself :-) > ___ gtk-app-devel-list mailing list gtk-app-devel-list@gnome.org https://mail.gnome.org/mailman/listinfo/gtk-app-devel-list
GtkImage XAlign dynamically
Hi, In glade gtkImage have xalign property to change image alignment. How can i change this in code dynamically? Thanks ___ gtk-app-devel-list mailing list gtk-app-devel-list@gnome.org https://mail.gnome.org/mailman/listinfo/gtk-app-devel-list
Re: Gtk+ progress bar color
If the default progress bar in GTK isn't what you are looking for then you can always make your own. You can design it how you want easy enough with a drawing area. With GTK3 you have OpenGL, Cairo, gradients, tensor-product patch meshes, etc. to draw with. You even have a frame clock for smooth animation if you want. If you figure out a progress bar that you like you can even package it as a re-usable object so that you can create many instances of the progress bar at once if you so need. Some simple progress bars. https://github.com/cecashon/OrderedSetVelociRaptor/blob/master/Misc/cairo_drawings/da_progress1.c Progress bars as an object. https://github.com/cecashon/OrderedSetVelociRaptor/tree/master/Misc/SteppedProgressBar Have a little fun programming. The tools are there. Eric ___ gtk-app-devel-list mailing list gtk-app-devel-list@gnome.org https://mail.gnome.org/mailman/listinfo/gtk-app-devel-list
Re: Gtk+ progress bar color
On Wed, 2017-03-08 at 15:23 +, Emmanuele Bassi wrote: > Sorry, we haven't yet found the way to write a `gtk_do_what_i_mean()` > function. > > > But we have to tell them: We should not > > do that, it may be possible with CSS... So we have no Kids in GTK > for > > more than 10 years now, so so new coders, only a few tired seniors > > left. > > Again, I have no idea what kind of "kids in GTK" you are referring > to. > I see a lot of newcomers approaching GTK and GNOME development, > though. > > You may be hanging around in the wrong places. > > Ciao, > Emmanuele. Yes maybe. I am subscribbed to gtk-list, gtk-app-devel, gtk-source-view and gedit list. The last two are absolutely death. Someone told me to try IRC, so I joined it some months ago for a few hours, there was no traffic at all, so I disconnected... Other places? Years ago there was a web forum without much traffic, I am not sure if that still exists. Well I have never looked on Facebook or youtube for GTK people :-) People generally start in age about 12 with programming, and they like to do something that is fun. 5 lines CSS code to change a color is not that much fun unfortunately. Do you think they come back to GTK when they have threir PhD? At least, the few GTK coders I am aware of are all 30 or more years old, most are even older. Currently I am working on high level gobject introspection Nim bindigs, as you may remember... ___ gtk-app-devel-list mailing list gtk-app-devel-list@gnome.org https://mail.gnome.org/mailman/listinfo/gtk-app-devel-list
Re: Gtk+ progress bar color
On 03/08/2017 07:23 AM, Emmanuele Bassi wrote: Sorry, we haven't yet found the way to write a `gtk_do_what_i_mean()` function. You aim too low; try for gtk_do_what_i_should_have_meant (). ___ gtk-app-devel-list mailing list gtk-app-devel-list@gnome.org https://mail.gnome.org/mailman/listinfo/gtk-app-devel-list
Re: Gtk+ progress bar color
On 8 March 2017 at 15:11, Stefan Salewski wrote: > On Wed, 2017-03-08 at 15:00 +, Rúben Rodrigues wrote: >> Thanks for your help... Yes i don't understand why gtk doesn't aloow >> us >> to do some "basic" things.. You're explicitly asking about GTK+ 2.x, whose API was last updated 6 years ago, and whose initial release was in 2001. GTK+ 2.x had a *very* simple theming API because all themes were basically shared libraries injecting custom rendering into applications. GTK+ 3.x, at least, has CSS. Of course, some people will moan that there isn't a function called "gtk_widget_set_this_color()". > Well, the GTK senior developers will say that such "color hacks" are > ugly and do not fit theming well. That may be true. But the Problem is: > When we try to teach Kids GTK programming, one of their first question > is: How can I change that color. I don't know who these "kids" are, but if you mean "newcomers", I've only seen people asking about changing colours of GTK widgets from people sending emails to this mailing list, and a minority *at best*. Usually, coming from software developers that are writing ad hoc applications coming from other, or older, platforms, whose only benefit is that they make it "easy" to change the colour of buttons in UIs. > They expect a simple function and > would have fun playing with it. Sorry, we haven't yet found the way to write a `gtk_do_what_i_mean()` function. > But we have to tell them: We should not > do that, it may be possible with CSS... So we have no Kids in GTK for > more than 10 years now, so so new coders, only a few tired seniors > left. Again, I have no idea what kind of "kids in GTK" you are referring to. I see a lot of newcomers approaching GTK and GNOME development, though. You may be hanging around in the wrong places. Ciao, Emmanuele. -- https://www.bassi.io [@] ebassi [@gmail.com] ___ gtk-app-devel-list mailing list gtk-app-devel-list@gnome.org https://mail.gnome.org/mailman/listinfo/gtk-app-devel-list
Re: Gtk+ progress bar color
I tried before run my app with different them like black but don't works. So if we don't should change the colors, why themes doesn't change too? On 08-03-2017 15:11, Stefan Salewski wrote: > On Wed, 2017-03-08 at 15:00 +, Rúben Rodrigues wrote: >> Thanks for your help... Yes i don't understand why gtk doesn't aloow >> us >> to do some "basic" things.. > Well, the GTK senior developers will say that such "color hacks" are > ugly and do not fit theming well. That may be true. But the Problem is: > When we try to teach Kids GTK programming, one of their first question > is: How can I change that color. They expect a simple function and > would have fun playing with it. But we have to tell them: We should not > do that, it may be possible with CSS... So we have no Kids in GTK for > more than 10 years now, so so new coders, only a few tired seniors > left. ___ gtk-app-devel-list mailing list gtk-app-devel-list@gnome.org https://mail.gnome.org/mailman/listinfo/gtk-app-devel-list
Re: Gtk+ progress bar color
Works for me too. Thank you! On 08-03-2017 15:02, Stefan Salewski wrote: > On Wed, 2017-03-08 at 15:52 +0100, Stefan Salewski wrote: >> On Wed, 2017-03-08 at 14:18 +, Rúben Rodrigues wrote: >>> I asked to the Google before, but he don't give me nothing about >>> this >>> :-). PRELIGHT doesn't work too.. >> > Well, the fix suggested by Owen Taylor in that old thread solved it for > me: > > #include > > gint main(gint argc,gchar *argv[]) > { >GtkWidget *window; >GtkWidget* bar; >GdkColor color; >GtkStyle *style; > >gtk_init (&argc,&argv); >window=gtk_window_new(GTK_WINDOW_TOPLEVEL); >bar=gtk_progress_bar_new(); >gdk_color_parse("red",&color); >gtk_widget_modify_bg(bar,GTK_STATE_NORMAL, &color); >gtk_widget_modify_bg(bar,GTK_STATE_PRELIGHT, &color); >gtk_widget_modify_bg(bar,GTK_STATE_ACTIVE, &color); >gtk_widget_modify_bg(bar,GTK_STATE_SELECTED, &color); >gtk_widget_modify_bg(bar,GTK_STATE_INSENSITIVE, &color); > >gtk_widget_modify_fg(bar,GTK_STATE_NORMAL, &color); >gtk_widget_modify_fg(bar,GTK_STATE_PRELIGHT, &color); >gtk_widget_modify_fg(bar,GTK_STATE_ACTIVE, &color); >gtk_widget_modify_fg(bar,GTK_STATE_SELECTED, &color); >gtk_widget_modify_fg(bar,GTK_STATE_INSENSITIVE, &color); > >style = gtk_style_new (); >gdk_color_parse ("red", &style->bg[GTK_STATE_PRELIGHT]); >gtk_widget_set_style (bar, style); >g_object_unref (style); > >gtk_progress_bar_set_fraction(GTK_PROGRESS_BAR(bar),0.5); >gtk_container_add(GTK_CONTAINER(window),bar); >gtk_widget_show_all (window); >gtk_main(); >return 0; > } ___ gtk-app-devel-list mailing list gtk-app-devel-list@gnome.org https://mail.gnome.org/mailman/listinfo/gtk-app-devel-list
Re: Gtk+ progress bar color
On Wed, 2017-03-08 at 15:00 +, Rúben Rodrigues wrote: > Thanks for your help... Yes i don't understand why gtk doesn't aloow > us > to do some "basic" things.. Well, the GTK senior developers will say that such "color hacks" are ugly and do not fit theming well. That may be true. But the Problem is: When we try to teach Kids GTK programming, one of their first question is: How can I change that color. They expect a simple function and would have fun playing with it. But we have to tell them: We should not do that, it may be possible with CSS... So we have no Kids in GTK for more than 10 years now, so so new coders, only a few tired seniors left. ___ gtk-app-devel-list mailing list gtk-app-devel-list@gnome.org https://mail.gnome.org/mailman/listinfo/gtk-app-devel-list
Re: Gtk+ progress bar color
On Wed, 2017-03-08 at 15:52 +0100, Stefan Salewski wrote: > On Wed, 2017-03-08 at 14:18 +, Rúben Rodrigues wrote: > > > > I asked to the Google before, but he don't give me nothing about > > this > > :-). PRELIGHT doesn't work too.. > > Well, the fix suggested by Owen Taylor in that old thread solved it for me: #include gint main(gint argc,gchar *argv[]) { GtkWidget *window; GtkWidget* bar; GdkColor color; GtkStyle *style; gtk_init (&argc,&argv); window=gtk_window_new(GTK_WINDOW_TOPLEVEL); bar=gtk_progress_bar_new(); gdk_color_parse("red",&color); gtk_widget_modify_bg(bar,GTK_STATE_NORMAL, &color); gtk_widget_modify_bg(bar,GTK_STATE_PRELIGHT, &color); gtk_widget_modify_bg(bar,GTK_STATE_ACTIVE, &color); gtk_widget_modify_bg(bar,GTK_STATE_SELECTED, &color); gtk_widget_modify_bg(bar,GTK_STATE_INSENSITIVE, &color); gtk_widget_modify_fg(bar,GTK_STATE_NORMAL, &color); gtk_widget_modify_fg(bar,GTK_STATE_PRELIGHT, &color); gtk_widget_modify_fg(bar,GTK_STATE_ACTIVE, &color); gtk_widget_modify_fg(bar,GTK_STATE_SELECTED, &color); gtk_widget_modify_fg(bar,GTK_STATE_INSENSITIVE, &color); style = gtk_style_new (); gdk_color_parse ("red", &style->bg[GTK_STATE_PRELIGHT]); gtk_widget_set_style (bar, style); g_object_unref (style); gtk_progress_bar_set_fraction(GTK_PROGRESS_BAR(bar),0.5); gtk_container_add(GTK_CONTAINER(window),bar); gtk_widget_show_all (window); gtk_main(); return 0; } ___ gtk-app-devel-list mailing list gtk-app-devel-list@gnome.org https://mail.gnome.org/mailman/listinfo/gtk-app-devel-list
Re: Gtk+ progress bar color
On Wed, 2017-03-08 at 14:18 +, Rúben Rodrigues wrote: > I asked to the Google before, but he don't give me nothing about > this > :-). PRELIGHT doesn't work too.. Yes, you are right. I just took this example: https://www.spinics.net/lists/gtk/msg00686.html //gcc -o simple t.c `pkg-config --libs --cflags gtk+-2.0` #include gint main(gint argc,gchar *argv[]) { GtkWidget *window; GtkWidget* bar; GdkColor color; gtk_init (&argc,&argv); window=gtk_window_new(GTK_WINDOW_TOPLEVEL); bar=gtk_progress_bar_new(); gdk_color_parse("red",&color); gtk_widget_modify_bg(bar,GTK_STATE_NORMAL, &color); gtk_widget_modify_bg(bar,GTK_STATE_PRELIGHT, &color); gtk_widget_modify_bg(bar,GTK_STATE_ACTIVE, &color); gtk_widget_modify_bg(bar,GTK_STATE_SELECTED, &color); gtk_widget_modify_bg(bar,GTK_STATE_INSENSITIVE, &color); gtk_widget_modify_fg(bar,GTK_STATE_NORMAL, &color); gtk_widget_modify_fg(bar,GTK_STATE_PRELIGHT, &color); gtk_widget_modify_fg(bar,GTK_STATE_ACTIVE, &color); gtk_widget_modify_fg(bar,GTK_STATE_SELECTED, &color); gtk_widget_modify_fg(bar,GTK_STATE_INSENSITIVE, &color); gtk_progress_bar_set_fraction(GTK_PROGRESS_BAR(bar),0.5); gtk_container_add(GTK_CONTAINER(window),bar); gtk_widget_show_all (window); gtk_main(); return 0; } And on my box the bar is still blue! GTK can be really hard and stubborn sometimes. I do not have the GTK2 source codes on my box currently, so I can not look at it currently. Maybe Mr Bassi or someone of the other few remaining GTK insiders is still following this thread. At least now your real goal is clear and we have tried it ourself :-) ___ gtk-app-devel-list mailing list gtk-app-devel-list@gnome.org https://mail.gnome.org/mailman/listinfo/gtk-app-devel-list
Re: Gtk+ progress bar color
I asked to the Google before, but he don't give me nothing about this :-). PRELIGHT doesn't work too.. On 08-03-2017 13:53, Stefan Salewski wrote: > On Wed, 2017-03-08 at 13:30 +, Rúben Rodrigues wrote: >> Yes, doesn't work for me.. Because: >> >> gtk_widget_modify_bg(GTK_WIDGET(gtk_builder_get_object(builder,"Menu_ >> Birds_ProgressBr")),GTK_STATE_NORMAL, >> &red); >> >> This changed background color, and this >> >> >> gtk_widget_modify_fg(GTK_WIDGET(gtk_builder_get_object(builder,"Menu_ >> Birds_ProgressBar")),GTK_STATE_NORMAL, &red); >> >> Change text color. I want to change bar color.. > Well, than we have to ask Mr Bassi or Google :-) Or look at the code... > > http://stackoverflow.com/questions/11172804/pygobject-gtk-entry-changing-progress-bar-color > > So please try gtk.STATE_PRELIGHT. ___ gtk-app-devel-list mailing list gtk-app-devel-list@gnome.org https://mail.gnome.org/mailman/listinfo/gtk-app-devel-list
Re: Gtk+ progress bar color
On Wed, 2017-03-08 at 13:30 +, Rúben Rodrigues wrote: > Yes, doesn't work for me.. Because: > > gtk_widget_modify_bg(GTK_WIDGET(gtk_builder_get_object(builder,"Menu_ > Birds_ProgressBr")),GTK_STATE_NORMAL, > &red); > > This changed background color, and this > > > gtk_widget_modify_fg(GTK_WIDGET(gtk_builder_get_object(builder,"Menu_ > Birds_ProgressBar")),GTK_STATE_NORMAL, &red); > > Change text color. I want to change bar color.. Well, than we have to ask Mr Bassi or Google :-) Or look at the code... http://stackoverflow.com/questions/11172804/pygobject-gtk-entry-changing-progress-bar-color So please try gtk.STATE_PRELIGHT. ___ gtk-app-devel-list mailing list gtk-app-devel-list@gnome.org https://mail.gnome.org/mailman/listinfo/gtk-app-devel-list
Re: Gtk+ progress bar color
Yes, doesn't work for me.. Because: gtk_widget_modify_bg(GTK_WIDGET(gtk_builder_get_object(builder,"Menu_Birds_ProgressBr")),GTK_STATE_NORMAL, &red); This changed background color, and this gtk_widget_modify_fg(GTK_WIDGET(gtk_builder_get_object(builder,"Menu_Birds_ProgressBar")),GTK_STATE_NORMAL, &red); Change text color. I want to change bar color.. THanks On 08-03-2017 12:49, Stefan Salewski wrote: > On Wed, 2017-03-08 at 12:29 +, Rúben Rodrigues wrote: >> Hi, >> >> Thanks. Yes i want to change in gtk 2.x and change it in my app >> only. >> There's no way in proprieties? > Do the ordinary GTK2 functions not work for your case? > Like gtk_widget_modify_fg() and gtk_widget_modify_bg() > > > https://developer.gnome.org/gtk2/stable/GtkWidget.html#gtk-widget-modify-fg > > http://stackoverflow.com/questions/99488/how-do-i-change-the-colors-of-an-arbitrary-widget-in-gtk > ___ gtk-app-devel-list mailing list gtk-app-devel-list@gnome.org https://mail.gnome.org/mailman/listinfo/gtk-app-devel-list
Re: Gtk+ progress bar color
On Wed, 2017-03-08 at 12:29 +, Rúben Rodrigues wrote: > Hi, > > Thanks. Yes i want to change in gtk 2.x and change it in my app > only. > There's no way in proprieties? Do the ordinary GTK2 functions not work for your case? Like gtk_widget_modify_fg() and gtk_widget_modify_bg() https://developer.gnome.org/gtk2/stable/GtkWidget.html#gtk-widget-modify-fg http://stackoverflow.com/questions/99488/how-do-i-change-the-colors-of-an-arbitrary-widget-in-gtk ___ gtk-app-devel-list mailing list gtk-app-devel-list@gnome.org https://mail.gnome.org/mailman/listinfo/gtk-app-devel-list
Re: Gtk+ progress bar color
Hi, Thanks. Yes i want to change in gtk 2.x and change it in my app only. There's no way in proprieties? On 07-03-2017 19:48, Stefan Salewski wrote: > On Tue, 2017-03-07 at 15:43 +, Rúben Rodrigues wrote: >>> Hi guys, >>> >>> How can i change progress bar color? >>> >>> Thanks >>> >> > For GTK 3.20 and above you can do it, using CSS. I did a similar fix > for scrollbar width for my 27 inch 4 display. I think I wrote how I did > it here some months ago. Basically you grap the CSS file, search for > progressbar, copy that section to ~/.config/gtk-3.0/gtk.css and modify > the color entry with a text editor. When you restart your application > you should notice the new color. > > But maybe you want to use GTK2, Windows or Mac, or change it only for a > specific app? > > And of course generally it may be a bad idea to modify single colors, > because it may not really fit for arbitrary themes. And, not all > widgets have plain colors, some have gradients and more. But I think > for progressbar there is indeed a single color defined for GTK 3.20. > And for personal use it should be OK. ___ gtk-app-devel-list mailing list gtk-app-devel-list@gnome.org https://mail.gnome.org/mailman/listinfo/gtk-app-devel-list