pygtk

Dynamically adding Items to CellRendererCombo in Liststore : Pygtk

跟風遠走 提交于 2019-12-11 04:24:19
问题 I am trying add items to CellRendererCombo dynamically. See the code below. When I click on 'Samsung' the corresponding items is listed in the combo box. Now the problem is, when I click 'LG' , the items corresponds to 'Samsung' is listed. In short, the combo box is showing items for the previously selected key, not for the current key. How can I solve this issue? #!/usr/bin/env python import gtk,os class CellRendererCombo: def __init__(self): window = gtk.Window() window.set_default_size(200

pygtk: asynchronous output implemented with io_add_watch blocks when printing large output dataset

泄露秘密 提交于 2019-12-11 04:17:20
问题 I'm writing a GTK+ GUI program with a python command line emulator. My python command line is implemented as a gtk.TextView, which can be used to output results of prints (and to read commands from TextView and exec them, but I don't post the input part here as it has nothing to do with the question). I use the following technique to tee the stdout stream between the real terminal and my python command line: r_out, w_out = os.pipe() # create a pipe, cause sys.stdout is unreadable, thus we can

Closing window is not quitting the application

核能气质少年 提交于 2019-12-11 04:13:05
问题 I was reading about builder.connect_signals which maps handlers of glade files with methods in your python file. Apparently works, except for the Main Window, which is not destroying when you close it. If you run it from terminal is still running and have to Ctrl-C to completely close the application. Here is my python code: #!/usr/bin/env python import pygtk import gtk #from gi.repository import Gtk import gtk.glade class Mixer: def __init__(self): self.gladefile = "mixer3.glade" self.wTree

PyGTK Hide Cursor

丶灬走出姿态 提交于 2019-12-11 04:03:48
问题 The question is simple how can I hide the cursor on an active window using PyGTK??? Here's a basic app I made to learn this... #!/usr/bin/env python import gtk class app: def __init__(self): window = gtk.Window(gtk.WINDOW_TOPLEVEL) window.set_title("TestApp") window.set_default_size(400,200) pixmap = gtk.gdk.Pixmap(None, 1, 1, 1) color = gtk.gdk.Color() cursor = gtk.gdk.Cursor(pixmap, pixmap, color, color, 0, 0) window.set_cursor(cursor) window.connect("destroy", gtk.main_quit) window.show

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

佐手、 提交于 2019-12-11 03:05:07
问题 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 would be infinitely handy to have an example of how these are used to save/load a textview with tags in it. Edit: I would like to clarify what I am trying to

Can someone explain Gtk2 packing?

廉价感情. 提交于 2019-12-11 02:07:35
问题 I need to use Gtk2 for a project. I will be using python/ruby for it. The problem is that packing seems kind of mystical to me. I tried using a VBox so that I could have the following widgets in my window ( in the following order ): menubar toolbar text view/editor control I've managed to "guess" my way with pack_start and get the layout I need, but I'd like to be able to understand it. The documentation at Ruby Gtk2 seems way too unintuitive (and so is the python one, since it's the same,

Gtk3 with Python, TextView rising multiple 'mark-set' signals

谁说我不能喝 提交于 2019-12-11 00:25:39
问题 Consider the following example code, which puts a TextView inside a window and registers the mark-set event: #!/usr/bin/env python3 from gi.repository import Gtk win = Gtk.Window(title='test') text_view = Gtk.TextView() def test (*args): print('test!') win.add(text_view) text_view.get_buffer().connect('mark-set', test) win.connect('delete-event', Gtk.main_quit) win.show_all() Gtk.main() If I launch it, and I click on the visualized TextView once I get the debug output multiple times: $ ./test

How do I update/redraw a GTK Widget (GTKLabel) internally without a key press event using python?

人盡茶涼 提交于 2019-12-10 20:56:13
问题 I have some code below that is attempting to update a GTK Label element. I'm including two files: the ui file and the py file. UI file: <glade-interface> <widget class="GtkWindow" id="ApplicationFrame"> <property name="width_request">320</property> <property name="height_request">240</property> <property name="visible">True</property> <property name="events">GDK_KEY_PRESS_MASK</property> <property name="title" translatable="yes">Simple</property> <property name="resizable">False</property>

Some questions about switches in python

拟墨画扇 提交于 2019-12-10 19:16:47
问题 This is my first Question here at StackOverflow, so please be patient with me if some info isn't present or I missed something important, but anyways i'll do my best :) Recently I started to code in Python2.7, so I'm not very good at it. While playing with PyGtk, PyGObject, Glade, etc I found something particular about switches (Haven't tried with any other widget, so I don't know if it happens somewhere else. Most likely it doesn't, I hope...) I made a very basic GUI with a single "window"

PyGTK: gobject.idle_add() and timeout_add() with threads

不羁岁月 提交于 2019-12-10 19:14:31
问题 Is there any unambiguous documentation stating whether locks (of any kind) are needed or not for idle_add() / timeout_add() and/or the actual callbacks installed by them? def work(*args): # (1) gtk.gdk.threads_enter() #needed? self.ui.change_some_label() # (2) gtk.gdk.threads_leave() #? # (3) gtk.gdk.threads_enter() #? gobject.idle_add (work) # (4) gtk.gdk.threads_leave() #? def main(): gtk.gdk.threads_init() #... Are 1+2 and/or 3+4 necessary? For which pygtk versions does this apply? I am