GTK +改变字体旋转按钮 [英] GTK+ change font to spin button
问题描述
flow_spin = gtk_spin_button_new_with_range(100,1500,25);我在GTK +中创建了一个旋转按钮。
我想改变它的字体和大小。我搜索了一下,以便找到一种解决方法,因为它看起来似乎旋转按钮小部件本身并没有改变它的格式,但没有任何工作。
这:
flow_spin.Child.ModifyFont(FontDescription.FromString(Courier 16));
以及此,无效:
flow_spin.Markup =< span size ='38000'>大文字< / span>;
至于这个,加号和减号按钮变大了,但是文字区域保持不变:
gtk_widget_set_size_request(flow_spin,50,50);
我看看是否可能有类似这样的方法?
gtk_label_set_markup(GTK_LABEL(label),< span font ='8'foreground ='black'weight ='normal'> 100< / span>) ;
由于我是C以及GTK +的初学者,因此我们将不胜感激。
Gtk支持用于样式的CSS。您可以使用gtk_css_provider_load_from_file()在您的程序中加载CSS文件。
所以,只需在GtkWidget上添加样式提供程序即可。好读:
I created a spin button in GTK+ like this:
flow_spin = gtk_spin_button_new_with_range (100,1500,25);
and I want to change it's font and size. I googled in order to find a workaround because it seems that the spin button widget doesn't change it's format natively, but nothing worked.
This:
flow_spin.Child.ModifyFont(FontDescription.FromString("Courier 16"));
as well as this, didn't work:
flow_spin.Markup = "<span size='38000'>big text</span>";
As for this, the plus and minus buttons got bigger, but the text area remained the same size:
gtk_widget_set_size_request ( flow_spin,50, 50);
I look if possibly for a method, similar to this ?
gtk_label_set_markup (GTK_LABEL (label), "<span font='8' foreground='black' weight='normal'>100</span>");
Since I am a beginner at C as well as GTK+, any suggestions would be appreciated.
Gtk supports CSS for styling. You can load a CSS file in your program with gtk_css_provider_load_from_file().
So, just add a style provider on GtkWidget you want to stylish.
It's good read:
- http://developer.gnome.org/gtk3/stable/theming.html
- https://thegnomejournal.wordpress.com/2011/03/15/styling-gtk-with-css/
这篇关于GTK +改变字体旋转按钮的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!