pygtk

PyGTK TreeColumns all exact duplicates

拟墨画扇 提交于 2019-12-11 16:13:14
问题 I wrote a simple PyGTK script to show some basic process information in a TreeView: import gtk import os import pwd import grp class ProcParser: """ Parses the status file of a particular process """ def __init__(self, fname): self.lines = map(lambda x: x[:-1], open(fname).readlines()) def get_by_val(self, val): for line in self.lines: if line.startswith(val): return line.split() return [] class Proc: """ A process in the /proc filesystem This class uses a ProcParser to determine it's own

How export methods with dbus in a extended class in python, inherited methods?

夙愿已清 提交于 2019-12-11 15:23:31
问题 I have a top class and classes that extend the top class, but almost all methods from the child classes are from the top class (using inheritance, without reimplementation), so I don't have the methods in the child classes, how could I export them with dbus for each child class (with the name of each child class as part of dbus path)? I will show a example code for clarify, my class structure is: Window (main class) |--WindowOne (child class) |--WindowTwo |--WindowThree My interface for dbus

How to display continuous data in a py-gtk window?

送分小仙女□ 提交于 2019-12-11 14:33:33
问题 I was trying to build a simple stopwatch app using py-gtk. Here is the callback function for the toggle button in my stopwatch window. def start(self,widget): if widget.get_active(): widget.set_label('Stop') else: self.entry.set_text(str(time.time() - s)) widget.set_label('Start') It works perfectly well except for the fact that time does not get continuously get displayed in the entry widget. If I add an infinite while loop inside the 'If ' condition like , while 1: self.entry.set_text(str

GtkAboutDialog Close Button Bug

安稳与你 提交于 2019-12-11 13:55:42
问题 I use GtkAboutDialog and everything works fine except the close button of this widget. All other buttons works fine, I don't know how but all buttons have default callbacks and they create and destroy the windows. But the "Close" button of GtkAboutDialog widget does not work. I can not even see it's widget. So, can I access it? [CLARIFICATION] What you're looking at is gtk.AboutDialog — popup window displaying information about an application (new in PyGTK 2.6). This window contains the

Twisted + Gtk - shutdown not working properly

只谈情不闲聊 提交于 2019-12-11 12:54:13
问题 Using Python 2.6, Twisted 10.1, and GTK+ 2.22, with latest pygtk installed, I'm having problems on shutdown. When I close my application and shut down the reactor (using the gtk2reactor of course), the application simply freezes. I've poked around the twisted source and added debug messages. What ends up happening is, the 'shutdown' event fires, PortableGtkReactor.crash is called, which calls gtk.main_quit . The event gets processed at the end of ReactorBase.runUntilCurrent . When the

Using a GTK window and waiting for the response

不打扰是莪最后的温柔 提交于 2019-12-11 09:43:52
问题 I am using PyGTK inside another application to take user input. I am building an window which has lots of Check Buttons and according to response I need to go ahead. The problem is that in python when I call the function of window and its operation, the program doesn't wait for the response from window? How do I make it able to wait for the response from the window?? I also don't know if I can use a dialog instead of window because I tried adding check buttons to dialog and it did not work

Where is the uri of the new window, in create-web-view?

非 Y 不嫁゛ 提交于 2019-12-11 09:17:56
问题 According to the documentation, the create-new-window signal is called when a webkit is creating a new window. I've been trying to override this to handle <a target='_blank' links in PyGTK webkit browser. In a subclass of WebView I have: ... self.connect("create-web-view", self.newWin) ... def newWin(view, frame, data): print view.get_property('uri') print frame.get_property('uri') print data.get_property('uri') It is called when a new-window link is clicked, but for some reason all of these

Python&PyGTK: Transport data to threading

血红的双手。 提交于 2019-12-11 09:16:26
问题 I would like to transfer data to threading class, but I can't get what is wrong. The code below is from this question and I changed it a little. This is a code: import gtk, gobject, threading, time gobject.threads_init() class T(threading.Thread): pause = threading.Event() stop = False def start(self, data, *args): super(T, self).start() def run(self, data): while not self.stop: self.pause.wait() gobject.idle_add(lambda *a : self.rungui(data)) time.sleep(0.1) def rungui(self, data): print

Failing to draw on a Gtk.DrawingArea

ぃ、小莉子 提交于 2019-12-11 08:38:39
问题 I'm not able to draw, i've already read tutorials, i can't find the problem. I simply have a correct UI drawed by Glade. Then i want to draw, for example 50 drawing areas. So i create a Grid with 50 cells; for each cell there is a vertical box (with a drawing area and a label inside each one). But i can't seen anything drawed. class collega_GUI: def __init__(self): try: self.__builder = Gtk.Builder() self.__builder.add_from_file('UI2.glade') self.__Grid = Gtk.Grid() self.__Grid.set_margin

How to listen socket, when app is running in gtk.main()?

眉间皱痕 提交于 2019-12-11 08:29:32
问题 I've tried to search, but nothing seems to work. For example: Separate threads I am currently writing simple communication app in Python2.7 with PyGTK. I have background process, which is listening socket in while loop like that. I want to display message, when I receive it form server. But when I start gtk.main(), it obviously starts to loop again, so my listening loop doesn't working. I need to display new window for each message or close old window and display new window with all unread