pygtk

Glade and deprecated gtk properties

家住魔仙堡 提交于 2019-12-25 04:27:33
问题 i've been trying to run a software where i've built the UI by Glade. Glade then transform the UI in an XML file, and then in Python i just load that file. But i've a problem with (maybe) deprecated properties of gtk objects. This is what the interpreter says: Unknown property: GtkScrolledWindow.min-content-width self.__builder.add_from_file('UI2.glade') /home/jimmy/Documenti/linguaggi_dinamici/progetto/collega_GUI.py:37: GtkWarning: Unknown property: GtkScrolledWindow.min-content-height self.

How to share clipboard data beetween processes in GTK?

你离开我真会死。 提交于 2019-12-25 00:15:12
问题 I want to: put some text into clipboard end my program paste data into other application but my code is not working: #!/usr/bin/env python import sys import gtk if __name__ == '__main__': if sys.argv[1] == 'put': clipboard = gtk.clipboard_get() clipboard.set_text('It\'s working') clipboard.store() elif sys.argv[1] == 'get': clipboard = gtk.clipboard_get() text = clipboard.wait_for_text() print('Text from clipboard: ', text) I put text into clipboard by executing python2 ./test.py put and

remove inner border on gtk.Button

孤人 提交于 2019-12-24 20:02:37
问题 I would like to remove border on a gtk.Button and also set its size fixed. How can I accomplish that? My button looks like that: b = gtk.Button() b.set_relief(gtk.RELIEF_NONE) Thanks! p.d: I'm using pygtk 回答1: You can use gtk.Widget.set_size_request to set a fixed size for the widget. Note that this is generally a bad idea, since the user may want a larger font size than you had planned for, etc. As for removing the border, gtk.Button can often take up more space than you wish it would. You

How to remove highlight from entry in pygtk?

心不动则不痛 提交于 2019-12-24 13:42:36
问题 i have a small GUI that i created, and when it fires up, the 'first' gtk.Entry that i have created is always highlighted (in a series of entries). essentially, here is how i create it: my_entry = gtk.Entry(1) my_entry.set_width_chars(1) my_entry.set_alignment(0.5) my_entry.set_text('1') i then go on to create several more entries. i then call 'show' on them all at the same time, and then use 'pack_start' to put them into a vbox. whenever i start the GUI, the '1' is highlighted. how can i

Include a library in python application

情到浓时终转凉″ 提交于 2019-12-24 13:39:31
问题 I am trying to find a way to include a library in a Ubuntu/Python/PyGtk application even though It is not included in the stock python enviornment and I can't add it as a dependency in my setup.py file. The library is called pygal and does have a PIP package (No available .deb or ppa) but I was looking for a way to include it in my application. I would think I could just include the source .py files to the library but I am unsure of how to go about including it in my code. Pygal also requires

How do I capture the selected row and column in a TreeView in PyGTK?

随声附和 提交于 2019-12-24 12:35:20
问题 I have a table created using gtk.TreeView . I want to know which row and column is selected by the user. How is this possible? 回答1: The methods for the rows you want are gtk.TreeSelection.get_selected or gtk.TreeSelection.get_selected_rows, depending on the selection method you have chosen (SELECTION_SINGLE, SELECTION_MULTIPLE OR SELECTION_BROWSE). http://www.pygtk.org/docs/pygtk/class-gtktreeselection.html#method-gtktreeselection--get-selected For columns you would work with gtk.TreeView.get

Gtk.CssProvider.load_from_data TypeError: Item 0: Must be number, not str

别说谁变了你拦得住时间么 提交于 2019-12-24 05:02:48
问题 I was getting this error when running my gtk project from a terminal with python3 myapp.py , but not when launching my app via Sublime-Text-3's python build system! How weird. TypeError: Item 0: Must be number, not str The code at fault was essentially: color_scheme = {'fg_color':'#ffffff', 'bg_color': '#000000',} css = """ GtkLabel { color: %(fg_color)s; background: %(bg_color)s; } """ # ... cssprovider = Gtk.CssProvider() css_data = css % color_scheme cssprovider.load_from_data(css_data)

Dynamically modifying/refreshing menu contents in PyGTK

帅比萌擦擦* 提交于 2019-12-23 17:03:14
问题 I am trying to implement a list of recently opened items in the menu of a GUI I am writing with PyGTK. I initialize the menu like so: self.filemenu = gtk.Menu() self.init_file_menu() self.fileitem = gtk.MenuItem("File") self.fileitem.set_submenu(self.filemenu) menubar = gtk.MenuBar() menubar.append(self.fileitem) outerframe.pack_start(menubar, False, False) def init_file_menu(self): for widget in self.filemenu.get_children(): self.filemenu.remove(widget) openitem = gtk.MenuItem("Open") self

PyGTK Multiprocessing and Updating GUI [closed]

橙三吉。 提交于 2019-12-23 09:36:29
问题 This question is unlikely to help any future visitors; it is only relevant to a small geographic area, a specific moment in time, or an extraordinarily narrow situation that is not generally applicable to the worldwide audience of the internet. For help making this question more broadly applicable, visit the help center. Closed 7 years ago . I am trying to enable and disable a stop button for audio playback in a GUI created using Glade PyGTK 2.0. The program basically works by running and

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

◇◆丶佛笑我妖孽 提交于 2019-12-23 06:06:07
问题 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) which is helpful for the most part but doesn't mention anything about manipulating the cursor position. 回答1: Looking at the gedit plugin API, it looks like gedit