gtk

Python GTK resizing large image to fit inside a window

 ̄綄美尐妖づ 提交于 2021-01-28 03:17:34
问题 Important note : I'm using PyGObject to get access to the GTK widgets, not PyGTK . That's what makes this question different from similar ones: PyGTK: How do I make an image automatically scale to fit it's parent widget? Scale an image in GTK I want to make a very simple app that displays a label, an image and a button, all stacked on top of each other. The app should be running in fullscreen mode. When I attempted it, I've run into a problem. My image is of very high resolution, so when I

Shutdown system tray icon on PyGObject

岁酱吖の 提交于 2021-01-27 14:22:48
问题 My vision of the program: icon in tray, left click on icon opens a window with shutdown, reboot, etc. buttons. The new Gnome specification advises to use notifications instead. StatusIcon >! (Deprecated since version 3.14: Use notifications) Unfortunately, I didn't find how Notify.Notification can be displayed in the tray. The only thing that I found is AppIndicator3.Indicator, but its constructor can only take a Gtk.Menu, which is unsuitable. Which classes may I use? 回答1: I had used

How to position an independent Window in an exact location on the screen?

感情迁移 提交于 2021-01-27 14:10:33
问题 I'm actually working on a relatively complex GTK+2 application. My application obviously have a main window; then I need to open a new "independent" Window. I need to place the "flying" window in a * precise position* of the screen, exactly at the vertices of a widget (a DrawingArea). I need to place the new window in a precise position of the screen, exactly at the vertices of a widget (a gtk.DrawingArea). So I thought the following algorithm: I get vertex coordinates of the DrawingArea

How to make a column with a string and pixbuf in GtkTreeview?

眉间皱痕 提交于 2021-01-27 07:45:33
问题 I'm working in a app with Gtk+2 and i need to implement a File treeview. the actual code it's: public FileTree() { store = new TreeStore(2,typeof(string),typeof(string)); this.change_dir( "/dir/path" ); set_model( store ); // File icon var pixbuf = new Gtk.CellRendererPixbuf(); var column = new Gtk.TreeViewColumn(); column.set_title(""); column.pack_start(pixbuf, false); column.add_attribute(pixbuf,"stock-id",0); column.set_alignment(1.0f); append_column (column); // File name Gtk

How to make a column with a string and pixbuf in GtkTreeview?

让人想犯罪 __ 提交于 2021-01-27 07:44:57
问题 I'm working in a app with Gtk+2 and i need to implement a File treeview. the actual code it's: public FileTree() { store = new TreeStore(2,typeof(string),typeof(string)); this.change_dir( "/dir/path" ); set_model( store ); // File icon var pixbuf = new Gtk.CellRendererPixbuf(); var column = new Gtk.TreeViewColumn(); column.set_title(""); column.pack_start(pixbuf, false); column.add_attribute(pixbuf,"stock-id",0); column.set_alignment(1.0f); append_column (column); // File name Gtk

How to make a column with a string and pixbuf in GtkTreeview?

我是研究僧i 提交于 2021-01-27 07:44:53
问题 I'm working in a app with Gtk+2 and i need to implement a File treeview. the actual code it's: public FileTree() { store = new TreeStore(2,typeof(string),typeof(string)); this.change_dir( "/dir/path" ); set_model( store ); // File icon var pixbuf = new Gtk.CellRendererPixbuf(); var column = new Gtk.TreeViewColumn(); column.set_title(""); column.pack_start(pixbuf, false); column.add_attribute(pixbuf,"stock-id",0); column.set_alignment(1.0f); append_column (column); // File name Gtk

glade: How to edit pages in a GtkAssistant

孤街浪徒 提交于 2021-01-27 06:46:26
问题 I would like to add content to the pages of an Assistant window (GtkAssistant) in Glade. When I add a new assistant, no children appear under the GtkAssistant. Further I cannot select (or delete or change) the contents of the 3 default pages Glade produces -- I can only select the assistant itself. So, I try increasing the number of pages to 5 and then adding a widget to one of the new pages. It gives me the error message: "Widgets of type Assistant need placeholders to add children." Is this

glade: How to edit pages in a GtkAssistant

非 Y 不嫁゛ 提交于 2021-01-27 06:44:17
问题 I would like to add content to the pages of an Assistant window (GtkAssistant) in Glade. When I add a new assistant, no children appear under the GtkAssistant. Further I cannot select (or delete or change) the contents of the 3 default pages Glade produces -- I can only select the assistant itself. So, I try increasing the number of pages to 5 and then adding a widget to one of the new pages. It gives me the error message: "Widgets of type Assistant need placeholders to add children." Is this

How to use glib-compile-resources with CMake

会有一股神秘感。 提交于 2021-01-05 11:31:47
问题 As any GTK project grows, GTK applications tend to be bundled with gresources to separate out code and UI design. This is very useful because UI/UX designers don't need to know code in order to... well design and ultimately contribute their skills and effort to the project. Not only designers but programmers too benefit a lot! Because code becomes heavily "logic or problem solving" instead of maintaining both UI and logic code together in one single file. However, to compile our GResource we

Get screen pixel color linux python3

我与影子孤独终老i 提交于 2021-01-04 08:59:26
问题 I have a working program in python 2.7 that I am trying to convert to python 3.3. The working version is: #!/usr/bin/python2 import gtk.gdk import sys def PixelAt(x, y): w = gtk.gdk.get_default_root_window() pb = gtk.gdk.Pixbuf(gtk.gdk.COLORSPACE_RGB, False, 8, 1, 1) cm = w.get_colormap() pb = pb.get_from_drawable(w, cm, x, y, 0, 0, 1, 1) return pb.pixel_array[0][0] print(PixelAt(int(sys.argv[1]), int(sys.argv[2]))) The partly converted one is: #!/usr/bin/python3 from gi.repository import Gtk