gtk

GTK keypress event propagation either causes recursion or does not work

我只是一个虾纸丫 提交于 2020-01-06 05:31:07
问题 I have a simple GTK program containing a single webkit2 widget in a window and nothing else. I want to be able to filter the keypresses going to the webkit2 widget. At first I added a key mask to the webkit widget and added a callback function, however after propogating the event in the callback function it just calls itself recursively which results in a crash. To resolve this I attached my key mask to the main-window, which is parent to my webkit widget, however this no longer prevents

Why can't I have a loop in the onclick function in PyGObject?

丶灬走出姿态 提交于 2020-01-06 05:26:15
问题 I am creating a user interface using PyGObject and I want the program to "run" a loop when a button is clicked and refresh the window accordingly. For example, in the following code, I want the program - on the click of the button - to update the label with a number, sleep for 1 second, increment the number and update the label again with the number, etc. The program currently, however, just shows the changes at the very end (after the loop is finished). How do I make the changes to the label

GTK+ adding references in MonoDevelop

一世执手 提交于 2020-01-06 05:23:10
问题 I am currently developing a GTK# application which will use a component to view a web page and make connection to an FTP server. So I found these two libraries, Webkit for viewing the web page and gFTP for the FTP connection. Now I've added the packages using Synaptic Package Manager. And the package references are added to a folder called '/usr/lib/pkconfig/'. Apparently this should add the libraries to the references-list I can use from in MonoDevelop, but neither of them show up. =/ I

Glade/gtkmm TreeView

ε祈祈猫儿з 提交于 2020-01-06 03:53:24
问题 In following up with an answer to my previous question on this issue, I've made some progress and am looking for the next bit of guidance. In brief, I'm having trouble loading up a Treeview from Glade with a gtkmm application. To start, here's the source. The class: typedef struct { Gtk::Window *window_info; Gtk::TreeView *treeview_info; Glib::RefPtr<Gtk::ListStore> liststore_info; class InfoColumns : public Gtk::TreeModel::ColumnRecord { public: InfoColumns() { add(time); add(message); } Gtk

Drawing text on GTK's DrawingArea in Haskell

被刻印的时光 ゝ 提交于 2020-01-06 02:41:15
问题 I have a DrawingArea onto which I can draw using primitives such as drawRectangle and drawLine . How do I draw text onto that area? I'm most interested in something that quickly outputs a single line of text. Graphics.UI.Gtk.Gdk.Drawable.layoutLine seems to be what I want, but it wants a Graphics.Rendering.Pango.Layout.LayoutLine as input. How do I construct that LayoutLine ? Are there better alternatives than doing it this way? Thanks! 回答1: I don't know if you would consider using Cairo. If

Change the window's opacity / hide it without affecting its childs

六眼飞鱼酱① 提交于 2020-01-06 01:45:26
问题 I simply have a drawing area, contained in a GtkWindow toplevel. How can I hide the window / make it fully transparent without doing that to its children too (in that case the the drawing area) ? I am aiming to the case in which everything drawn by the program is just the canvas drawing. 来源: https://stackoverflow.com/questions/32534734/change-the-windows-opacity-hide-it-without-affecting-its-childs

How to avoid closing of Gtk.Dialog in Python?

与世无争的帅哥 提交于 2020-01-05 15:08:13
问题 I have a form in a Gtk.Dialog which has an "Ok" button and a "Cancel" button. When I click on the Ok button, the dialog returns 1 and when I click on Cancel button, it returns 0. What I want to make is to validate the fields of the form so that if any field has invalid data, like letters in a numeric field or empty fields, the dialog can not be destroyed if Ok button is pressed. 回答1: You could define a custom dialog. Here you can find an example. Make shure to destroy the dialog only if your

Unable to import gtk after installing PyGObject

做~自己de王妃 提交于 2020-01-05 12:55:23
问题 I can import gtk without any problem previously. I made a GUI in glade for GTK+ 3. Then I thought that I would like to try GTK+ 3. So I installed PyGObject. I later found out that PyGObject has little documentation and I'm using Windows (makes things worse I know). The problem is here, I can't use import gtk anymore. Neither can I use from gi.repository import Gtk . I've tried installing PyGTK bundle again but it doesn't help. >>> import gtk Traceback (most recent call last): File "<pyshell#0

Installing Python GTK

霸气de小男生 提交于 2020-01-05 08:22:10
问题 I have recently stated a arduino project for my engineering class. I mange to get python to talk to arduino via serial communication. Now I can send data to the board, I want to be able to set up a graphical user interface GUI with GTK, so that the user and push a button in the GUI and a LED turns on. However, I am trying to install the GTK liberty and I am running into a lot of problems. Problem: I download GTK via pyip, when I run the set up file in the command line it says you have to

GTK3: Getting a style's class property

你离开我真会死。 提交于 2020-01-05 08:07:49
问题 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"