gtk

Is there a gi.repository documentation for python?

有些话、适合烂在心里 提交于 2019-12-31 09:10:23
问题 I'm looking for a gi.repository module documentation and I can't find anything on the internet. All I found is documentation of new Gtk3 libraries for C, or old PyGtk 2.0 Reference Manual I'm looking for something like PyGtk 2.0 Reference Manual but for Gtk3. Is there something similar for Python? (I'm not looking for dir(Gtk) or help(Gtk) in the Python console.) 回答1: I think you're looking for this. It's a work in progress, but basically is a tutorial for Gtk3 in python. I doesn't really

Detect specific keypresses in GUI

那年仲夏 提交于 2019-12-31 07:11:30
问题 I'm looking for a way in Gtk/Python to have an app listen for keypresses and when some of the special keys are pressed, perform an action (recreate a menu with different labels, since it's an appindicator). I can't really find a way to do it though. If anyone is able to help, I'd be thankful. 回答1: You probably need to handle the "key-press-event" (and probably also "key-release-event") of GtkWidget. PyGtk knows about it. It should be inside some "windowing" widget, so you may need to use

Making a GtkButton round

℡╲_俬逩灬. 提交于 2019-12-31 03:21:12
问题 How can I make GtkBtton round in shape? 回答1: There are a few options. Tweak the style. There is no roundness option in the base set. Some theme engines may provide border image specification or roundness but it will not work everywhere. Force a theme that looks the way you want it too. This is not too hard you just load a gtkrc string that specifies the theme you want. You will need to ensure users have the theme or are ok with the fallback. Subclass the button and draw it yourself. One way

How to use GTK+ with ada

Deadly 提交于 2019-12-31 02:37:06
问题 Anyone can show me some examples, simple, how to use GTK with Ada? examples, like: How to use Glade with Ada, create an simple window.... an simple window, like this: #include <gtk/gtk.h> int main(int argc, char *argv[] ) { GtkWidget *window; gtk_init (&argc, &argv); window = gtk_window_new (GTK_WINDOW_TOPLEVEL); gtk_widget_show (window); gtk_main (); return 0; } And, It's possible to use GtkMM, with ada ? Thanks... 回答1: A few of my favorite GtkAda programs: Animation demo Linxtris Mine

How to search through a gtk.ListStore in pyGTK and remove elements?

限于喜欢 提交于 2019-12-31 02:29:09
问题 I have the following code (where store is a gtk.ListStore and titer is a gtk.TreeIter . The docs say that if there is no next row, iter_next() will return None , hence the break when that is found. It is supposed to search through the ListStore of (int, str) and remove the one item whose int component matches item_id. while True: if store.get_path(titer)[0] == item_id: store.remove(titer) break else: titer = store.iter_next(titer) if titer is None: break However, if an element in the middle

How do you change alternating background row colors of a gtk.TreeView in pygtk?

笑着哭i 提交于 2019-12-30 20:00:53
问题 I'm trying to change the alternating background color of a treeview. I know that this should normally be left up to the theme, but I'd like to override to test the gtk Style functionality. According to the treeview documentation here, I learned that the TreeView has several style options that are Read-only, including "even-row-color", "odd-row-color" and "allow-rules"(which according to the documentation, allows drawing of even and odd row colors). And I know that in order to override those

gtk_events_pending() returns FALSE with events still pending

拟墨画扇 提交于 2019-12-30 09:34:32
问题 I'm working on an application that has a start and stop button. These buttons block the UI, and for various reasons, I can't spawn a thread. I've been showing a working screen when these buttons are pressed, using: while (gtk_events_pending()) gtk_main_iteration(); which ensures that the working screen is loaded before the start/stop operations begin. I've recently upgraded to GTK+ 3.8.6, and it seems that gtk_events_pending() is now broken. Now, sometimes the window shows, but the image in

import gtk/glib produces ImportError: DLL load failed

☆樱花仙子☆ 提交于 2019-12-30 08:41:15
问题 I installed the latest versions of python (2.6.5), gtk+, pygtk (and friends) from their respective websites on Windows XP SP3. When you try to import gtk (or just glib for that matter), an ImportError is raised: Python 2.6.5 (r265:79096, Mar 19 2010, 21:48:26) [MSC v.1500 32 bit (Intel)] on win32 Type "help", "copyright", "credits" or "license" for more information. >>> import gtk Traceback (most recent call last): File "<stdin>", line 1, in <module> File "C:\Python26\lib\site-packages\gtk-2

GtkWarning: could not open display

妖精的绣舞 提交于 2019-12-30 07:29:10
问题 I am trying to run a spider on a vps (using scrapyjs which uses python-gtk2). On running the spider I am getting the error /root/myporj/venv/local/lib/python2.7/dist-packages/gtk-2.0/gtk/__init__.py:57: GtkWarning: could not open display How do I run this in a headless setup? 回答1: First of all, you didn't specify if you have a desktop environment (or X) installed on your server? Regardless of that, you can achieve headless setup for your spider by using xvfb : Xvfb or X virtual framebuffer is

Embedding SDL into GTK+

我的未来我决定 提交于 2019-12-30 06:57:19
问题 I have an application that uses GTK+ to display some nice GUI, but I am using SDL to display a small RGB frame buffer inside GTK+ I have used the following code to get SDL into GTK+: char SDL_windowhack[32]; sprintf(SDL_windowhack, "SDL_WINDOWID=%ld", GDK_WINDOW_XWINDOW(deviceWindow->window)); putenv(SDL_windowhack); Unfortunately, I also use SDL for keyboard and mouse event. The main thread that uses SDL to update the image spawns the following thread: void *SDLEvent(void *arg) { SDL_Event