pygtk

Interacting with a gtk.container while gtk.main() is executing?

一个人想着一个人 提交于 2019-12-07 10:41:46
问题 Experimenting with a battery monitor icon at the moment in Python using pygtk and egg.trayicon to create an icon to display a battery icon/tooltip. I seem to be able to add the icon and the tooltip text, but when it then reaches the gtk.main() stage I need a way to modify these so it can then show the updated values. I've tried gobject.idle_add() and gobject.timeout_add() without much luck, not sure where to go from this. Anyone got any ideas? EDIT : Perhaps not the clearest of questions. I

gtk custom spin button

家住魔仙堡 提交于 2019-12-07 09:53:49
I want to make a gtk SpinButton, but for inputting dates. Is there an easier way to input dates into GTK? If not, how can I create a SpinButton look-alike, but whose output is text representing dates instead of integers? Ideally I'd re-use the arrows, the clicks, the integration with the adjustment, etc. I really just need the output to look different, as I can even represent dates as integers. The calendar is a bit large, but you can find code putting it in a popup. Personally I use a regular text entry and parse the date. As for SpinButton, it is based on a text entry, so you might be able

GtkTreeView's row right click

岁酱吖の 提交于 2019-12-07 05:45:56
问题 How do I do something when user right click in a treeview's row? 回答1: It's really easy, just listen to the "button-press-event" signal and use treeview.get_path_at_pos() to figure the selected row: def button_press_event(treeview, event): if event.button == 3: # right click model, path = treeview.get_path_at_pos(int(event.x), int(event.y)) # do something with the selected path treeview.connect('button-press-event' , button_press_event) 来源: https://stackoverflow.com/questions/4570859

QT4, GTK+, wxWidgets or IronPython for a native Windows app using Python

浪尽此生 提交于 2019-12-07 05:18:28
问题 I need to build a native windows app using Python (and py2exe, I guess). Feature requirements are: Taskbar icon Alert notifications (next to Taskbar Icon) Chromeless window (ideally a pretty, rounded, coloured one). Webkit to render some of the Chromeless window So far I've identified the following possible toolkits: pyGTK pyQT4 wxWidgets ironpython I haven't used any of these before and so I look to you for advice on the suitability or pitfalls of choosing one of the above. Many thanks for

How do I raise a window that is minimized or covered with PyGObject?

佐手、 提交于 2019-12-07 04:56:18
问题 I'd been using the answer provided in the PyGTK FAQ, but that doesn't seem to work with PyGObject. For your convenience, here is a test case that works with PyGTK, and then a translated version that doesn't work with PyGObject. PyGTK Version: import gtk def raise_window(widget, w2): w2.window.show() w1 = gtk.Window() w1.set_title('Main window') w2 = gtk.Window() w2.set_title('Other window') b = gtk.Button('Move something on top of the other window.\nOr, minimize the' 'other window.\nThen,

display leading zero in a gtk.SpinButton

允我心安 提交于 2019-12-07 04:37:49
问题 i'd like to have a leading zero in a spinbutton in order to always have two digits displayed. adj_hour = gtk.Adjustment(int(time.strftime("%H")),0,24,1,1) entry_hour = gtk.SpinButton() entry_hour.set_adjustment(adj_hour) problem is that gtk.Adjustment's first argument has to be float/int. i tried things like: adj_hour = gtk.Adjustment(float(format(int(time.strftime("%H")), '02d')),0,24,1,1) but it doesn't work. 回答1: Connect to the output signal of the spin button. For example, adapting the C

“WindowsError: [Error 2] The system cannot find the file specified” is not resolving

核能气质少年 提交于 2019-12-07 04:19:02
问题 I have created exe file of my python project by py2exe which have number of files. when i run this exe file in my system. it works fine but if i put it in another system then it opens login form, then after it doesn't go to next window which i have written in 2nd python file. it gives me below error in log file. Traceback (most recent call last): File "login.py", line 246, in DataReader File "subprocess.pyo", line 711, in __init__ File "subprocess.pyo", line 948, in _execute_child

How to disable the close button in GTK?

∥☆過路亽.° 提交于 2019-12-07 02:41:26
I have created a One Time Password mechanism in OpenERP 6.0.3's GTK client. After login the GTK client shows a window to enter the One Time Password as below. Now I want to disable the close button at the top left of the window. How can I do that? I am using python and the code to create the window is: EDIT class sms_auth(gtk.Dialog): def run_thread(self): code=self.textbox_code.get_text() self.result = rpc.session.rpc_exec_auth('/object', 'execute', 'res.users', 'check_code', code) return self.result def run(self): self.show_all() res = super(sms_auth, self).run() result = None if res == gtk

Automatic image scaling on resize with (Py)GTK

可紊 提交于 2019-12-07 02:28:39
问题 I have a GtkImage widget in a resizable window and a reference GdkPixBuf storing the image I want to fill the GtkImage with. I can scale the GdkPixBuf to fill the GtkImage widget using this method: def update_image(self, widget=None, data=None): # Get the size of the source pixmap src_width, src_height = self.current_image.get_width(), self.current_image.get_height() # Get the size of the widget area widget = self.builder.get_object('image') allocation = widget.get_allocation() dst_width, dst

GtkTreeView insert/update performance penalty because of sorting

空扰寡人 提交于 2019-12-07 02:07:26
问题 I'm having performance problems when inserting many rows into a GTK treeview (using PyGTK) - or when modifying many rows. The problem is that the model seems to get resorted after each change (insert/modification). This causes the GUI to hang for multiple seconds. Leaving the model unsorted by commenting out model.set_sort_column_id(SOME_ROW_INDEX, gtk.SORT_ASCENDING) eliminates these problems. Therefore, I would like to disable the sorting while I'm inserting or modifying the model, and re