pygtk

gtkButton dissabled or enabled

Hi to all. how can i make enabled or dissabled gtk.Button? Thank you ...

Setting the cursor position in PyGTK (for a Gedit plugin)

I'm developing a Gedit plugin which is built on PyGTK. I'm trying to figure out how to programatically tell the cursor where to go. For example, I'd like to have the cursor automatically go to right before the first "|" (pipe) in the current line. Any ideas or starting points? I've been using the Gedit API up until now (right here) whic...

Room for improvement on my Python code?

I'm working on a Gedit plugin using Python (and PyGTK) and I really havent' worked with Python much so I have no idea if I'm writing Pythonic code. All of my own code is contained in __init__.py. There are a few other files, but they're from an outside library that I'm hooking into. My __init__.py is as follows: # # @file __init__.py #...

[pygtk] get num-page of notebook

Hi to all. I have one notebook with some tabs in my form and in this tabs i have label-button for closing tab. I have code for this: def new_tab(self,label): self.scrolled_window = gtk.ScrolledWindow() self.add(self.scrolled_window) self.scrolled_window.add_with_viewport(self.editor_access()) self.scrolled_window.set_polic...

[PyGTK] How can I show a widget and all its parent containers?

In my program, there is a point where all widgets are hidden. Is there a simple way to show a widget and all of its parent containers? I am not able to use show_all(), because that would show other widgets that I don't want shown. I could go down the containers and show them all, but I would prefer not to if there is a more concise solut...

[pygtk] Change tab-label on gtk.noteBook

Hi to all. I have a gtk.Notebook with some tabs on it. How can i change label on current tab when button clicked? I make: self.set_tab_label(self.scrolled_window,label) But label change on last tab, but not in current :( Thank you. ...

[pygtk] get label from notebook tab

Hi to all. I have a gtk.Notebook and i want get text of label from current gtk.noteBook tab. I make that: text = self.get_tab_label(self.get_nth_page(self.get_current_page())) if i print text i see: But in gtk help i read that: get_tab_label_text: returnvalue: the text of the tab label, or None if the tab label widget is not a gtk.L...

[pygtk] catch close gtk.window

Hi ti all. I have gtk.Window and I need to catch closure. I need to close the show the message dialog and click Yes if the window should be closed unless there is a show window Thank you. ...

GTK/GDK How to find out if a window is overlayed by another one?

I've got a gtk application which features a tray icon, if the user clicks on the icon the visibility of the window is toggled when he's on the same workspace as the window is. When he's on another workspace the window moves to that one. Now, if the application and user are on the same screen and the app is completely overlayed by anothe...

Python Drawing Portion of Image When Mouse Hover

Hi My question relates to Python GTK I have an image -a JPG - which I draw onto a drawing area. I want to reveal a portion of the image -say a 10pix by 10 px square -only where the mouse pointer is currently at. Everything 10 x 10 px square away from the mouse should hidden i.e. black. I'm am new to PyGtk please can anyone help? Tha...

Dump X clipboard data with GTK+ or PyGTK

How do I paste HTML data from the X clipboard using PyGTK/GTK+? I would need something like xclip, but with the ability to output clipboard data as HTML, not just as plain text. I'm using PyGTK, but I am not afraid of plain GTK+ in C. I've read GtkClipboard and PyGTK's gtk.Clipboard references, and I've found this question, but I would...

[pygtk] Get children from gtk.ScrolledWindow

Hi to all. i have Window and gtk.ScrolledWindow on it, and gtk.TextView in this scrooledWindow. How can i get textview? Thank you ...

How do you rotate a gtk widget?

Hello good people, Let's say the widget in question is a VBox containing a Label and two Buttons. Furthermore, let's say the degree of rotation desired is 90°. How does one go about rotating it? I do not think this is possible by default but I do think it is possible. However, I have no idea how to get started. Do I write a custom wi...

Linux/Python: Monitor /proc/acpi files without polling?

Is there any way to monitor /proc files, such as /proc/acpi/battery/BAT0/state /proc/acpi/ac_adapter/ADP0/state in a non-polling fashion, similar to inotify on a normal filesystem? I want to do this in a PyGTK app, so I tried using PyGObject's gio.FileMonitor, but no dice. A Python solution that plays well with gtk.main() would be id...

Examples of well written simple PyGTK apps?

I'm looking to get my hands dirty with PyGTK and was wondering if anyone can recommend any relatively simple, really cleanly written PyGTK apps that I can look to for best practices or examples? Any type of app will do, as long as it's simple-ish (i.e., please don't recommend a huge app) and generally considered to be well written. The ...

[pygtk] Find text in gtk.TextView

Hi to all. I have a gtk.Textview and i want to make text find and selecting this text in this textview. I have this code but, it's not true. search_str = self.text_to_find.get_text() start_iter = textbuffer.get_start_iter() match_start = textbuffer.get_start_iter() match_end = textbuffer.get_end_iter() found = start_iter.f...

rounded rectangle in pygtk

what is the best way to draw a rounded rectangle in a pygtk application ...

GTK StatusIcon: Coordinates of left-click?

Hello, how do I get the x/y-coordinates of a left click in a Gtk StatusIcon? This is my first GTK app and I'm stuck. Is there any way to get details about the last button event that occurred? Or is it possible to pass those details to the handler function when connect()ing the "activate" callback? Greets, Philip ...

Python: how to switch between workspaces using Xlib?

Hi, how do I switch between my window manager's workspaces using Python with Xlib module? I've been searching Google the last couple of hours, and this is my most promising attempt: #!/usr/bin/python from Xlib import X, display, error, Xatom, Xutil import Xlib.protocol.event screen = Xlib.display.Display().screen() root = screen.r...

Where can I find the gtk-builder-convert script?

I've built a small GUI app for work that uses some .glade files for pop-up windows. Recently, the ground beneath me was shifted - my environment was upgraded. Newer pyGTK versions require GTKBuilder and .xml files instead of Glade and .glade files and now my poor app is broken. I need to convert the .glade file to the newer .xml file....