pygtk

Gtk* backend requires pygtk to be installed

守給你的承諾、 提交于 2019-12-07 00:59:13
问题 From within a virtual environment, trying to load a script which uses matplotlib 's GTKAgg backend, I fail with the following traceback: Traceback (most recent call last): File "<stdin>", line 1, in <module> File "/home/user/.virtualenvs/venv/local/lib/python2.7/site-packages/matplotlib/pyplot.py", line 97, in <module> _backend_mod, new_figure_manager, draw_if_interactive, _show = pylab_setup() File "/home/user/.virtualenvs/venv/local/lib/python2.7/site-packages/matplotlib/backends/__init__

How can I change the font size in GTK?

前提是你 提交于 2019-12-07 00:28:42
问题 Is there an easy way to change the font size of text elements in GTK? Right now the best I can do is do set_markup on a label, with something silly like: lbl.set_markup("<span font_desc='Tahoma 5.4'>%s</span>" % text) This 1) requires me to set the font , 2) seems like a lot of overhead (having to parse the markup), and 3) would make it annoying to change the font size of buttons and such. Is there a better way? 回答1: If you want to change font overall in your app(s), I'd leave this job to

pygtk change background color of gtkHBox widget

杀马特。学长 韩版系。学妹 提交于 2019-12-06 23:38:22
问题 I have a GTK ui that has a gtkVBox that gets gtkHbox's containing content dynamically added to it as the user works. The ui is getting crowded and it's difficult to tell what Hbox the components belong to (they repeat.) I would like to alter the background color of the gtkHboxes so it alternates between a lighter and darker color for each one. Basically, I'm creating a dynamic table of combo boxes where each row represents an object. Now I need to segment the rows since they are quiet complex

Embed interactive shell (VTE) in a PyGtk GUI to manipulate its own widgets

送分小仙女□ 提交于 2019-12-06 16:08:47
I am planning to do the folliwing: Create a PyGtk GUI (hardcoded, no Glade) with some widgets, and at the bottom of the screen put some sort of VTE (Virtual Terminal Emulator) from where I could manipulate the widgets, for example changing their attributes and calling their methods from the commandline. The result would be similar to using AutoCAD's commands, only that I would be acting upon the GUI objects. I have already found very few things about gtk.VteTerminal widget, but not only could not find a working example or make one myself, it also seem to be a system terminal, not a "current

PyGtk3 how to change application theme?

偶尔善良 提交于 2019-12-06 14:57:45
问题 i tried rc_parse method using Gtk.rc_parse("path/to/Hooli/gtk-3/gtk.css") code but it is not working. this question is simlpy but solution of question not easy. how can i change the my gtk apllication theme ? or how can i use custom theme on my gtk application ? Thanks. 回答1: import gi gi.require_version("Gtk", "3.0") from gi.repository import Gtk as gtk settings = gtk.Settings.get_default() settings.set_property("gtk-theme-name", "Numix") settings.set_property("gtk-application-prefer-dark

Gtk warning after ugrading to yosemite

末鹿安然 提交于 2019-12-06 14:54:20
I am trying to run a program written in python on my mac (Yosemite). Almost immediately after starting the program it gives me the following error: Gtk-WARNING **: Locale not supported by C library. Using the fallback 'C' locale. [edit] tried to isolate the issue, the error appears upon entering Adriaan$ ipython --gui=gtk Python 2.7.8 (default, Nov 5 2014, 15:41:54) Type "copyright", "credits" or "license" for more information. IPython 2.3.0 -- An enhanced Interactive Python. ? -> Introduction and overview of IPython's features. %quickref -> Quick reference. help -> Python's own help system.

Embed a spreadsheet/table in a PyGTK application?

帅比萌擦擦* 提交于 2019-12-06 12:31:20
In my application, we want to present the user with a typical spreadsheet/table (OO.O/Excel-style), and then pull out the values and do something with them internally. Is there a preexisting widget for PyGTK that does this? The PyGTK FAQ mentions GtkGrid , but the link is dead and I can't find a tarball anywhere. nosklo GtkGrid is deprecated in favor of the more powerful and more customizable GtkTreeView . It can display trees and lists. To make it work like a table, you must define a ListStore where it will take the data from, and TreeViewColumn s for each column you want to show, with

Load GTK-Glade translations in Windows using Python/PyGObject

落爺英雄遲暮 提交于 2019-12-06 11:00:32
I have a Python script that loads a Glade-GUI that can be translated. Everything works fine under Linux, but I am having a lot of trouble understanding the necessary steps on Windows. All that seems necessary under Linux is: import locale [...] locale.setlocale(locale.LC_ALL, locale.getlocale()) locale.bindtextdomain(APP_NAME, LOCALE_DIR) [...] class SomeClass(): self.builder = Gtk.Builder() self.builder.set_translation_domain(APP_NAME) locale.getlocale() returns for example ('de_DE', 'UTF-8') , the LOCALE_DIR just points at the folder that has the compiled mo-files. Under Windows this makes

Detect ctrl+click on button in pygtk

自作多情 提交于 2019-12-06 09:23:55
I want to detect if ctrl is held down when the user clicks a button. The 'clicked' signal doesn't seem to pass enough information to the callback to work this out. If you can connect to either button-press-event or button-release-event instead of clicked , the event passed to the callback can be used to get the modifier state (using get_state ) and check if control key is pressed. For ex. def button_release_callback(widget, event, data=None): if event.get_state() & gtk.gdk.CONTROL_MASK: print "Ctrl held" else: print "Ctrl not held" ... button.connect("button-release-event", button_release