gtk3

How to get the background color of a widget in GTK and Python?

放肆的年华 提交于 2019-12-10 14:47:07
问题 I want to get the normal background color of a widget (a GtkHeaderBar , in this case). I'm currently using style = self.get_titlebar().get_style_context() to get the style, and color = style.get_property("background-color", Gtk.StateFlags.NORMAL) to get the background color associated to that style. However it returns a Gkd.RGBA object with the following properties: Gdk.RGBA(red=0.000000, green=0.000000, blue=0.000000, alpha=0.000000) But if I open GTK Inspector, select the HeaderBar, and

Where to get precompiled GTK3 for windows? [duplicate]

浪子不回头ぞ 提交于 2019-12-10 13:36:21
问题 This question already has answers here : Where can I download precompiled GTK+ 3 binaries or windows installer? [closed] (5 answers) Closed 6 years ago . Is there any place where I can download precompiled GTK3 for windows? The GTK site only provides binaries for the 2.22 version. 回答1: GTK+ for Windows in generated by volunteers... So release dates are not synchronized, and depend on the availability of the people working on it. Once they are done, it will be available on the GNOME FTP

Given a Gtk Notebook, how does one drag and drop a page to a new window?

非 Y 不嫁゛ 提交于 2019-12-10 12:22:31
问题 Just like the title says, I have a Gtk Notebook and wish to DND a notebook page onto a new window. Does anyone have an example? 回答1: Here is a full fledged example how to create a window upon dropping a page outside the current window, including how to DND between notebooks, and how to destroy the sub window after all pages are removed. #!/usr/bin/env python import gi gi.require_version('Gtk', '3.0') from gi.repository import Gtk class GUI: def __init__(self): self.window = Gtk.Window() self

Get attributes of GnomeKeyring key with Python 2.7 GTK3 on Ubuntu 14.04

纵饮孤独 提交于 2019-12-10 12:18:53
问题 I am using Linux Mint 17, based on Ubuntu 14.04 I have installed: python-gnomekeyring 2.3.2 python-gi 3.12 python-gtk2 2.24 I want to use the GnomeKeyring. I save and read a key name an key password, but I annot access the attributes. When I try to access them I always get: *** Error in `python': double free or corruption (out) Here is my code, I created this today to work with the GnomeKeyring: #!/usr/bin/python # -*- coding: utf8 -*- import gi gi.require_version('Gtk', '3.0') gi.require

The Button.connect syntax in Genie

喜你入骨 提交于 2019-12-10 11:36:18
问题 I want to apply a certain behaviour to a label. When a lateral button is clicked, the corresponding label should rotate 90 degrees. It can be easily done in vala, but I can't discover the particular syntax on genie. The vala code I am trying to reproduce comes from elementary OS getting started guide: hello_button.clicked.connect(() => { hello_label.label = "Hello World!"; hello_button.sensitive = false; }); rotate_button.clicked.connect(() => { rotate_label.angle = 90; rotate_label.label =

Adding an icon to a ToolButton in Gtk 3

有些话、适合烂在心里 提交于 2019-12-10 10:59:54
问题 Is there a way to add an icon to a Gtk.ToolButton (Gtk3 using PyGi for Python) to add to the GTK+3 toolbar ? Below is my code: self.addfile = Gtk.ToolButton() self.addfile.set_label("Add File") self.addfileimg = Gtk.Image() self.addfileimg.show() self.addfileimg.set_from_file(self.get_resource("img/file.png")) self.addfile.set_icon_widget(self.addfileimg) self.addfile.connect("clicked", self.on_open_file) Note: The get_resource() method digs into the local working folder for the resource path

How to limit number of decimal places to be displayed in Gtk CellRendererText

前提是你 提交于 2019-12-09 23:14:14
问题 I am trying to limit the amount of decimal places shown in a Gtk.CellRendererText. Currently a float number field is shown with 6 decimal places, but I would like to have just 1. This test code should work on Linux: #!/usr/bin/python3 from gi.repository import Gtk class MyWindow(Gtk.Window): def __init__(self): Gtk.Window.__init__(self, title="Hello World") self.set_default_size(200, 200) self.liststore = Gtk.ListStore(float) treeview = Gtk.TreeView(model=self.liststore) self.liststore.append

Set the hover background color of a Gtk3 MenuItem

巧了我就是萌 提交于 2019-12-09 18:51:08
问题 I have a tray icon with a popup menu. I am trying to set the background color of the menu items in this popup. I am able to set the text color but not the background color of the menu item. The background that appears is the default Ubuntu orange, and I can't override it. I've created a sample application that demonstrates this problem. Just copy-paste it into a .py file and it should run. from gi.repository import Gtk, Gdk import sys class TrayIcon: def __init__(self): self.statusicon = Gtk

using cairo with gtk3

拥有回忆 提交于 2019-12-09 08:03:30
I am trying to draw a scatterplot with cairo in gtk3. To start, I am using the examples here: http://zetcode.com/tutorials/cairographicstutorial/ They compile with gtk2 successfully but display no image. They do not compile with gtk3 but give the following error: example.c: In function ‘on_expose_event’: example.c:17:31: error: ‘GtkWidget’ has no member named ‘window’ Any help on this would be greatly appreciated. btw I am using writing using ArchLinux for this if that helps. another.anon.coward There have been quite a few changes in Gtk3. There is no member window exposed as part of GtkWidget

Learning GUI programming with GTK+2 or GTK+3?

牧云@^-^@ 提交于 2019-12-08 17:59:25
问题 I am new to GUI programming, and I haven't found yet what library is best for my purpose (i want to make desktop environment applications, eg. docks, panels, desklets etc.) I have started learning basics of GTK, mainly using PyGtk. Most tutorials i found on line are for GTK+2.0. Recently however, GTK+3 has been released. So i am a bit unsure as to what that means for my learning curve: Should i learn using GTK+3 and forget about GTK+2? Does using one or the other really makes a difference