gtk3

Remove widget from Gtk viewport / scrolled window in dynamic GUI

百般思念 提交于 2019-12-01 12:27:40
问题 I am building a GUI (Python binding of GTK3) where one Gtk Scrolled Window (from Glade) can contain different treeviews. The program launches with an empty window and the first time around everything works with: self.scrolled_window.add_with_viewport(treeview) self.main_window.show_all() Edit: Picture of the test program (see source below): The second time around I get the following error: (main.py:15905): Gtk-CRITICAL **: gtk_scrolled_window_add_with_viewport: assertion 'gtk_bin_get_child

Extending from GtkBin

放肆的年华 提交于 2019-12-01 10:47:48
问题 I'm trying to make a custom widget that resembles the "quick search" entry that Gtk uses on all TreeView-like widgets. Here's a simplified example of my initial idea: from gi.repository import Gtk class QuickSearch(Gtk.Bin): def __init__(self, *args, **kwargs): super(QuickSearch, self).__init__(*args, **kwargs) self.add(Gtk.Entry()) win = Gtk.Window() win.connect("delete-event", Gtk.main_quit) search = QuickSearch() win.add(search) win.show_all() Gtk.main() The problems are the following: If

How do I change the property of a GTK widget such as a stack?

三世轮回 提交于 2019-12-01 07:39:17
I've been taking a quick look at the GTK 3.10 documentation for a GtkStack. https://developer.gnome.org/gtk3/3.10/GtkStack.html It mentions that the child added to a GtkStack is given a property "icon-name". My question is - how can I change the value of this property. The reason - I want to change the GtkStackSwitcher button to be an icon not text but I want to code this - not use a GktBuilder UI. If you look at the gtk3-demo - Stack demo and the UI file you can see the GtkSwitcher has an icon. <?xml version="1.0" encoding="UTF-8"?> <interface> <!-- interface-requires gtk+ 3.6 --> <object

Best way to set Entry Background Color in Python GTK3 and set back to default

耗尽温柔 提交于 2019-12-01 05:57:55
What is the best way to set background color for one entry and set it back to the default color? My script is now working but I am very sure this is not the best way. Also I still have two problems: If I insert a text, not containing string "red" or "green" and select this text I cant see my selection because It is all white. I think there are better ways then the way I insert self.entry_default_background_color_str into the CSS text. import gi gi.require_version('Gtk', '3.0') from gi.repository import Gtk from gi.repository import Gdk class Window(Gtk.Window): def __init__(self): self.screen

How to alternate light/dark rows in GtkTreeView?

本秂侑毒 提交于 2019-12-01 04:55:15
问题 I have read, and tried the existing solutions for this question, and I can't get them to work. I was hoping someone could point out what I'm doing wrong, or tell me why those solutions aren't working anymore. https://thegnomejournal.wordpress.com/2011/03/15/styling-gtk-with-css/ (5 years old) Widgets to list files with gtk (2 years old) How do you change alternating background row colors of a gtk.TreeView in pygtk? (4 years old) https://askubuntu.com/questions/285559/how-to-reenable

Python. Doing some work on background with Gtk GUI

别来无恙 提交于 2019-12-01 04:48:58
python 3.2.2 gtk3 3.2.2 python-gobject 3.0.2 I'm trying to display a GUI and do some work in the background. As I understand it should look something like this: #!/usr/bin/env python3 # -*- coding: utf-8 -*- import time from threading import Thread from gi.repository import Gtk, Gdk class Gui(): def run(self): self.Window = Gtk.Window() self.Window.set_border_width(8) self.Window.set_title("Некий GUI") self.Window.connect('destroy', lambda x: self.stop()) self.outBut = Gtk.Button.new_from_stock(Gtk.STOCK_OK) self.outBut.set_size_request(150, 35) self.outBut.connect('clicked', lambda x: self

How to create a complete menu using GIO Actions in PyGI GTK?

丶灬走出姿态 提交于 2019-12-01 04:05:38
I'm trying to convert the menubar in my Gtk app so it will use GActions (from the Gio) as opposed of GtkActions in Python3 using GObject Instrospection. I've been trying to figure it out on my own but so far it seems awfully complicated and I didn't have much luck with it. If someone could please post an example of how to create a simple menu GAction based with A submenu A menu item with a stock ID icon / hotkey A menu item with a non-stock icon / hotkey A checked menu item And radio menu item group A disabled(grayed out) menu item It would really help me a lot. EDIT : This is the menubar I

Best way to set Entry Background Color in Python GTK3 and set back to default

旧街凉风 提交于 2019-12-01 03:46:30
问题 What is the best way to set background color for one entry and set it back to the default color? My script is now working but I am very sure this is not the best way. Also I still have two problems: If I insert a text, not containing string "red" or "green" and select this text I cant see my selection because It is all white. I think there are better ways then the way I insert self.entry_default_background_color_str into the CSS text. import gi gi.require_version('Gtk', '3.0') from gi

Python. Doing some work on background with Gtk GUI

假装没事ソ 提交于 2019-12-01 01:58:50
问题 python 3.2.2 gtk3 3.2.2 python-gobject 3.0.2 I'm trying to display a GUI and do some work in the background. As I understand it should look something like this: #!/usr/bin/env python3 # -*- coding: utf-8 -*- import time from threading import Thread from gi.repository import Gtk, Gdk class Gui(): def run(self): self.Window = Gtk.Window() self.Window.set_border_width(8) self.Window.set_title("Некий GUI") self.Window.connect('destroy', lambda x: self.stop()) self.outBut = Gtk.Button.new_from

How can I change the font size of a Gtk.Label in vala?

痞子三分冷 提交于 2019-12-01 00:34:30
I'm a Vala/Gtk newbie and I'm trying to change the font size of a Gtk.Label, but I can't find a good way to do it. I find out that I can use the markup like this : var welcome_message = new Gtk.Label ("<span size='17000'>Hello</span>"); welcome_message.set_use_markup (true); But it seems a little hackish. What is the right way to do it ? You could try with css, I think lately this is the preferred way. Give your label a class, then load a css. If you are going to change the font size of a label, I bet you are also going to customize other things so the css may be useful for you. Thanks