gtk

Placing a window near the system tray

I am writing a program that needs to set a window just above/below the traybar for gtk. I have tried using the 2 approaches that failed. One was using the gtk_status_icon_position_menu function and placing the window in the point where the user clicks (in the tray bar). The problem is that these solutions work in gnome(Linux) but not in ...

Need example/help with GtkTextBuffer (of GtkTextView) serialize/deserialize

I am trying to save user's bold/italic/font/etc tags in a GtkTextView. Using GtkTextBuffer.get_text() does not return the tags. The best documentation I have found on this is: http://www.pygtk.org/docs/pygtk/class-gtktextbuffer.html#method-gtktextbuffer--register-serialize-format However, I do not understand the function arguments. It ...

What should I choose: GTK+ or Qt?

Can someone suggest what's the best uses for those libraries today? Is it just GUI, or do they have database, XML, networking, threading, etc support too? I was reading about them, and considered starting to learning/using one of them. What is the most common one? What's the difference between them? Why would you choose one over the ot...

How to change properties of DrawingArea in Gtk2Hs

Can someone please point me in the right direction when it comes to changing properties of an element in Gtk2Hs. For example, how do I change the background-color of a DrawingArea? ...

How to get a current font for GtkTextView?

It's pretty easy to set the default font for a GtkTextView via gtk_widget_modify_font(), but how to get which one is current? (I'm not using any tags in the widget.) ...

Giving focus to GNOME docked window

I've got a GTK/GDK docked window that I need to give keyboard focus to, so accelerator keys (shortcuts) work. Does anybody know if GNOME even allows a docked window to have keyboard focus, and if so, how can I enable it? Thanks, Mike ...

How to give keyboard focus to a pop-up Gtk.Window

I have a pop-up window (created using the WINDOW_POPUP type) which contains some widgets on it, including a text entry. The problem is that the entry doesn't get the focus when I click on it, so I can't type anything. Is there any flag I have to set to allow the window to get the keyboard focus? ...

How to get an exact size of a GtkTextBuffer in bytes?

At the present time I'm doing it like: GtkTextBuffer *buf = gtk_text_view_get_buffer(...); gtk_text_buffer_get_bounds(buf, &start, &end); gchar *data = gtk_text_buffer_get_text(buf, &start, &end, true); gint size = strlen(data); // ouch But this is rather ugly. I found (and tested) gtk_text_iter_get_offset() but it returns the size in...

How can I copy a remote image over HTTP to gtk.gdk.pixbuf by Python?

Hello, this is first post here and I am a noob programmer. This may be a stupid question. I'd like to create a personal Twitter notifier on GNOE Desktop. And I've decided to use pynotify and Tweepy. Now I just want to make pynotify show Twitter user's icon, and there seems to be 2 ways using pynotify; setting URI to local image file, or...

pygtk: howto change background of a gtk.TextView widget

I want to make the background of a textview widget black and the foreground white. Been trying the .modify_bg and .modify_fg methods, but none affect the way this thing looks. Can anyone suggest anything or is this just not possible? ...

How does GTK Statusbar work? What's wrong with my code?

Dear developers, I would like to have a statusbar, so I started by making a small program with just a statusbar, so I could see how it worked. Right now I would just like to be able to get some text in it, but it shows a random character instead. Can someone see what's wrong with my code? #include <gtk/gtk.h> int main (int argc, cha...

Glade and static linking

If I'm statically linking a GTK+ program under FreeBSD 8, gtk_builder_add_from_file() suddenly returns with an error: Invalid object type `GtkWindow' How to fix that? With dynamic linking everything works fine. Update: linking is done by: cc -o foobar foo.o bar.o main.o -Wall -pedantic -std=c99 D_THREAD_SAFE -DORBIT2=1 -D_REENTRAN...

Is there any Visual Studio-like tool for creating GUIs for Python?

My girlfriend asked me if there was a tool (actually, an IDE) that would let her create her GUI visually and edit functions associated with GUI-related events with little effort. For example, she wants to double-click a button she just created and immediately see (and edit) the code associated with that button's on-click event. I believ...

How can you use a font file in GTK

I'm writing an open source program (key-train) in Python and GTK (with Cairo) and I would like to use some more attractive fonts. I was hoping that it would be possible to load a ttf font from within the program and just use it (instead of installing it), but I haven't been able to figure out how to do this. ...

In Gtk, when is it better to use Glade/GtkBuilder than native code?

Glade helped me get started on a project quickly, but I've found it harder to maintain in the long run, and I'm thinking about switching it all to native code. In what circumstances would you choose glade, and when would you use native code? ...

What's the right way to append a ToolButton to a Toolbar in Gtk?

Monodoc tells me "AppendItem" is deprecated, but it doesn't tell me what to use instead. ...

What does "GLib-GObject-WARNING **: instance with invalid (NULL) class pointer" mean?

Whenever I close my Gtk# application, I get this: (/home/matthew/opensbs/OpenSBS/bin/Debug/OpenSBS.exe:5050): GLib-WARNING **: g_set_prgname() called multiple times (/home/matthew/opensbs/OpenSBS/bin/Debug/OpenSBS.exe:5050): GLib-GObject-WARNING **: instance with invalid (NULL) class pointer (/home/matthew/opensbs/OpenSBS/bin/Debug/Op...

In Gtk#, how do I get a Window's AccelGroup?

The constructor for a stock ImageMenuItem requires an AccelGroup. I think I should use the main Window's AccelGroup, but I'm not sure how to get it. Edit: It turns out you can use the Stock Enum in ImageMenuItem (string label), not just in ImageMenuItem (string stockId, AccelGroup accelGroup). So I don't really need to get the Window's ...

How do I make a Gtk.Frame's label bold?

Usually, for Labels you can do something like this: Label label = new Label ("<b>Some Text</b>") { UseMarkup = true }; However, Gtk.Frame's label is just a string, not a full-fledged Label. I can't find an option to use markup. How to I enable markup, or otherwise set the label to be bold? ...

In Gtk#, how do I reset a timer that was set with GLib.Timeout.Add?

I'd like to save the state of a widget once it has not been editted for 2 seconds. Right now, my code looks something like this: bool timerActive = false; ... widget.Changed += delegate { if (timerActive) return; timerActive = true; GLib.Timeout.Add (2000, () => { Save (); timerActive = false; ...