gtk3

MVC with Python3 and Gtk3

不问归期 提交于 2019-12-07 10:18:25
Is there any way to use MVC pattern with Python3 and Gtk3? I found a library called pygtkmvc , but it's based on pygtk , that is, gtk2 . MVC is a pattern, you don't need a library in order to use it. It would go something like this contrived example: import gi gi.require_version('Gtk', '3.0') from gi.repository import Gtk, GObject class Model(object): @property def greetee(self): return 'World' class Controller(object): def __init__(self, model, view): self._model = model self._view = view self._view.connect('button-clicked', self._on_button_clicked) self._view.connect('destroy', Gtk.main_quit

What is the Vulkan equivalent of the GtkGLArea widget (GTK+)?

£可爱£侵袭症+ 提交于 2019-12-07 09:22:52
问题 Background: I want to write a CAD application. I want to implement all rendering with Vulkan. And I want to use GTK+. I don't want a (visible) different window for the rendered image of the object. So I researched and found the GtkGLArea widget, which seems to do what I want, but for OpenGL. Is there an equivalent to GTKGLArea ? If not, is there another way to implement what I'm thinking of? 回答1: There is a GdkWindow which I believe is behind many Gtk graphic types such as GtkWindow and

How do I raise a window that is minimized or covered with PyGObject?

佐手、 提交于 2019-12-07 04:56:18
问题 I'd been using the answer provided in the PyGTK FAQ, but that doesn't seem to work with PyGObject. For your convenience, here is a test case that works with PyGTK, and then a translated version that doesn't work with PyGObject. PyGTK Version: import gtk def raise_window(widget, w2): w2.window.show() w1 = gtk.Window() w1.set_title('Main window') w2 = gtk.Window() w2.set_title('Other window') b = gtk.Button('Move something on top of the other window.\nOr, minimize the' 'other window.\nThen,

How to hide a Gtk+ FileChooserDialog in Python 3.4?

天涯浪子 提交于 2019-12-07 04:51:38
问题 I have a program set up so that it displays a FileChooserDialog all by itself (no main Gtk window, just the dialog). The problem I'm having is that the dialog doesn't disappear, even after the user has selected the file and the program has seemingly continued executing. Here's a snippet that showcases this issue: from gi.repository import Gtk class FileChooser(): def __init__(self): global path dia = Gtk.FileChooserDialog("Please choose a file", None, Gtk.FileChooserAction.OPEN, (Gtk.STOCK

ERROR: ld.so: object 'libgtk3-nocsd.so.0' from LD_PRELOAD cannot be preloaded

[亡魂溺海] 提交于 2019-12-06 21:47:22
问题 Running into this issue when working with Hugo and the AWS CLI on Ubuntu 18.04. ERROR: ld.so: object 'libgtk3-nocsd.so.0' from LD_PRELOAD cannot be preloaded (failed to map segment from shared object): ignored. This is a fresh install of Ubuntu 18.04, Hugo, and AWS CLI. 回答1: Found the answer after a bit of web searching here: https://github.com/PX4/Firmware/issues/9409 If you update your .bashrc with the below line it should fix the issue: export LD_PRELOAD=/usr/lib/x86_64-linux-gnu/libgtk3

The Button.connect syntax in Genie

孤者浪人 提交于 2019-12-06 15:36:35
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 = "Verbal"; rotate_button.sensitive = false; }); I actually managed to reproduce almost entirely the code

GTK+ CSS for one button

爷,独闯天下 提交于 2019-12-06 11:41:11
How to set color for one button in GTK+ GtkButton button8 { border-radius: 20; border-width: 1 1 1 1; font: Sans 16; color: black; background-image: -gtk-gradient (linear, left top, left bottom, color-stop(0.0,rgba(34,97,170,1)), color-stop(0.50,rgba(56,145,218,1)), color-stop(0.51,rgba(34,131,216,1)), color-stop(1.00,rgba(134,191,234,1))); } This css changes the color of al buttons in glade file.How should i change the css so that it affects only one button? gtk_widget_set_name (widget, "fooname"); or do the same in glade: then use something like GtkButton#fooname { border-radius: 20; ... }

Drawing a custom GdkPixbuf using Gtk3 and cairo

怎甘沉沦 提交于 2019-12-06 10:32:54
问题 I would like to draw a custom shape in a cell of a Gtk.TreeView, using Python and GTK3. I have found out that cairo shall be used for this, but could not find any way to create a suitable Pixbuf object. I can load a file from the disk easily; but then I have no means to draw on it. It appears to be a common and easy task, still several hours searching for the solution through Internet did not help. How shall I implement the " Add a row with a custom-drawn image " block so that e.g. a small

Glib-GIO-ERROR when opening an file chooser dialog

蹲街弑〆低调 提交于 2019-12-06 09:37:35
I use GTK3 , codeblcks IDE, glade3 in windows 7... In my application i have a button which when clicked should open a gtk_file_chooser_dialog... But gives the fillowing error.. Glib-GIO-ERROR** : No GSettings schemas are installed on the system static void on_save_clicked(GtkWidget *widget,gpointer data) { GtkWidget *dialog; //dialog=gtk_file_chooser_dialog_new("Save it",GTK_WINDOW(gtk_builder_get_object(builder,"mainwindow")),GTK_FILE_CHOOSER_ACTION_SAVE,GTK_STOCK_OK,GTK_RESPONSE_OK,GTK_STOCK_CANCEL,GTK_RESPONSE_CANCEL); //dialog=GTK_FILE_CHOOSER_DIALOG(gtk_builder_get_object(builder,

How to use a custom font in a GTK app

拟墨画扇 提交于 2019-12-06 08:22:27
问题 I have a font file /path/to/app/fonts/custom-font.ttf and I want to use it. How do you import a custom TTF for use in a GTK+3.0 app? from gi.repository import Gtk, Pango # ... lbl = Gtk.Label() lbl.modify_font(Pango.FontDescription("sans 48")) # lbl.modify_font(Pango.FontDescription("custom-font 48")) 回答1: If you want to using it as a preview to your own app, install the font and uncomment the last line (provide the right name). If you want to use it as custom font for final release, i