ProgrammingThis forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Introduction to Linux - A Hands on Guide
This guide was created as an overview of the Linux Operating System, geared toward new users as an exploration tour and getting started guide, with exercises at the end of each chapter.
For more advanced trainees it can be a desktop reference, and a collection of the base knowledge needed to proceed with system and network administration. This book contains many real life examples derived from the author's experience as a Linux system and network administrator, trainer and consultant. They hope these examples will help you to get a better understanding of the Linux system and that you feel encouraged to try out things on your own.
Click Here to receive this Complete Guide absolutely free.
I am writing a program in C to create a GUI application using GTK 2. My actual program is quite large, so I am using a modified version of the sample program from GNOME library for trial.
I wish to increase the font size, and I have using PangoFontDescription. I have made that section of the code bold and italic below for quick reference to the code that affects fonts. But it does not make any difference. I am compiling the C file using gcc.
I tried the above code, yet the font size is fixed at its default value. Plus when I am executing the code, I get the following message in the terminal.
(hello:2479): Gtk-WARNING **: Attempting to add a widget with type GtkLabel to a GtkButton, but as a GtkBin subclass a GtkButton can only contain one widget at a time; it already contains a widget of type GtkLabel
Can a label be added inside the button? This message seems to suggest that.
In fact, a button itself has no way of displaying text. It does so by containing a label. That way, they don't have to rewrite the text-displaying code for every widget with text in it, and also it means you can put anything in a button, including pictures and even other buttons!
A button, as a subclass of bin, can only hold one child object at a time. The function "gtk_button_new_with_label", as the name implies, creates a button with a label already in place. That's why tecknophreak's code fails, it's trying to add a label to a button that already has one. Change the new button code to just "gtk_button_new()", then use the code to add a label with the bigger font.
Alternatively, use "gtk_button_new_with_label", then use "gtk_bin_get_child" to get the actual label, and change the font of that control.