gtk

GTK3: Getting a style's class property

心已入冬 提交于 2020-01-05 08:07:03
问题 I'm trying to get the text color of a class of a GTK style. I have a GtkStyleContext with the widget path and the classes that I want to get their properties. GtkWidgetPath* widgetPath = gtk_widget_path_new (); gtk_widget_path_append_type(widgetPath, GTK_TYPE_WINDOW); gtk_widget_path_iter_set_name(widgetPath, -1 , "UnityPanelWidget"); GtkStyleContext *context = gtk_style_context_new(); gtk_style_context_set_path(context, widgetPath); gtk_style_context_add_class(context, "gnome-panel-menu-bar"

How to change data of a GtkTreeModel (within “edited” callback)

 ̄綄美尐妖づ 提交于 2020-01-05 05:44:28
问题 I'm catching the "edited" signal of my GtkCellRenderer: GtkTreeModel * sortmodel; // contains a sorted model of GtkListStore // ... GtkCellRenderer * renderer; // ... g_object_set(renderer, "editable", TRUE, NULL); g_signal_connect(renderer, "edited", G_CALLBACK(onEdited_name), sortmodel); I'd now like to change the content of the cell accordingly, but I don't find any function, that would change the content of a cell of a GtkTreeModel. void onEdited_name(GtkCellRendererText *cell, gchar *

GTK Scrolled Window - Keep Scroll Bar at bottom

▼魔方 西西 提交于 2020-01-05 05:30:11
问题 I have a GTK/C++ program that uses a ScrolledWindow. I keep adding data to the list within the scrolled window, and I want to keep focus on the newest item. But I also want to allow the user to scroll through the data to select an old item. Is there a way to do this? I've looked everywhere but can't find anything. 回答1: It's not quite clear to me what you mean by your question, but here's what I think you mean: when you add items to your list, they are added below the current visible portion

clone a GtkWidget from glade so it will be reusable several times in application

放肆的年华 提交于 2020-01-04 15:29:08
问题 I'm writing a Gtk+3 application in C. The user interface is built with glade. I created an independent GtkBox that should be used in several places in my application. When I try to use that GtkBox more then once I get the following error: (tuxmusicstudio:27491): Gtk-WARNING **: Attempting to add a widget with type GtkBox to a container of type GtkBox, but the widget is already inside a container of type GtkBox, please use gtk_widget_reparent() How can I clone the GtkWidget so it will be

clone a GtkWidget from glade so it will be reusable several times in application

微笑、不失礼 提交于 2020-01-04 15:28:20
问题 I'm writing a Gtk+3 application in C. The user interface is built with glade. I created an independent GtkBox that should be used in several places in my application. When I try to use that GtkBox more then once I get the following error: (tuxmusicstudio:27491): Gtk-WARNING **: Attempting to add a widget with type GtkBox to a container of type GtkBox, but the widget is already inside a container of type GtkBox, please use gtk_widget_reparent() How can I clone the GtkWidget so it will be

Properly structure and highlight a GtkPopoverMenu using PyGObject

限于喜欢 提交于 2020-01-04 15:26:35
问题 I am trying to make an example of a proper Gtk.HeaderBar with Gtk.PopoverMenus that shows how the different widgets are used. I looked at a lot of examples and code, but can't figure out, how to work the Gtk.ModelButton . Especially this sentence makes no sense to me: When the action is specified via the “action-name” and “action-target” properties, the role of the button (i.e. whether it is a plain, check or radio button) is determined by the type of the action and doesn't have to be

dbus Variant: How to preserve boolean datatype in Python?

偶尔善良 提交于 2020-01-04 09:27:38
问题 I've been experimenting with dbus lately. But I can't seem to get my dbus Service to guess the correct datatypes for boolean values. Consider the following example: import gtk import dbus import dbus.service from dbus.mainloop.glib import DBusGMainLoop class Service(dbus.service.Object): def __init__(self): bus_name = dbus.service.BusName("org.foo.bar", bus = dbus.SessionBus()) dbus.service.Object.__init__(self, bus_name, "/org/foo/bar") @dbus.service.method("org.foo.bar", in_signature = "a

gtk.Builder() and multiple glade files breaks

前提是你 提交于 2020-01-04 08:23:13
问题 I have a glade gui, and I want to insert another object using a glade file as well. When I do it as bellow (this is essentially what I am doing) the whole app hangs and the self.show() and maxes out the CPU at 100%. If I replace the first line of one's init () with self.builder = gtk.Builder() then the app runs, I can set widgets, ie: set contents of entry's, set and change the values of comboboxes. But I cant respond to signals, button clicks never call the handler. In the real code the

How to introspectively connect handlers to signals?

天涯浪子 提交于 2020-01-04 04:39:08
问题 gtk.Builder is capable to identify all signals that a GUI (described in a XML file) can emit and with the method connect_signals() automagically matches signals and handlers. Example: class Gui(gobject.GObject): def __init__(self): self.gui_file = "../data/gui.xml" builder = gtk.Builder() builder.add_from_file(self.gui_file) builder.connect_signals(self) def on_whatever_gui_event(self, widget, data=None): ... In my application I have other signals that are generated by non-GUI objects (it's

How to remove frame (or border?) form a GtkScrolledWindow

不想你离开。 提交于 2020-01-04 03:49:12
问题 How I can remove the frame (or the border if it is...) of a GtkScrolledWindow (gtk#)? Use of window.ShadowType = ShadowType.None; don't work, window.BorderWidth=0; don't work... Thanks for help! 回答1: Set the FormBorderStyle property of your Form to None. 来源: https://stackoverflow.com/questions/4927416/how-to-remove-frame-or-border-form-a-gtkscrolledwindow