gtk3

GTK/C and GtkBuilder to make a single executable

我的梦境 提交于 2019-12-04 05:12:24
问题 In my project I call gtk_builder_add_from_file function to load an xml file with the ui objects designed with Glade previously. So, I have my binary program and (in the same folder) the xml file. What is the best way to pack all into a single executable? should I use a self-extracting script? or there is something else to compile all together? Thanks to all 回答1: You can use the GResource API available in GIO. GResources work by defining the assets you wish to ship with your application inside

Destructing Glib::RefPtr causes failed assertions in the GTK 3 core

夙愿已清 提交于 2019-12-04 04:50:33
The guys from Gtkmm are comparing Glib::RefPtr with std::auto_ptr<> : Glib::RefPtr is a smartpointer. Specifically, it is a reference-counting smartpointer. You might be familiar with std::auto_ptr<> , which is also a smartpointer, but Glib::RefPtr<> is much simpler, and more useful. But for some strange reason, I can't get my work done with the RefPtr . The same code is just fine with a auto_ptr . In the following code, SmartPtr is just a placeholder for one of these two smartpointers. #include <gtkmm.h> #include <iostream> #include <tr1/memory> struct WindowHolder { SmartPtr<Gtk::Window> ptr

Python/Gtk3 : How to add a Gtk.Entry to a Gtk.MessageDialog?

旧巷老猫 提交于 2019-12-04 04:37:14
问题 Good morning, I'm trying to add a Gtk.Entry to a Gtk.MessageDialog . With the following code it seems that I added the Gtk.Entry but it's not visible on the dialog window (Python3/Gtk3) : #!/usr/bin/python3 from gi.repository import Gtk def get_user_pw(parent, message, default=''): dialogWindow = Gtk.MessageDialog(parent, Gtk.DialogFlags.MODAL | Gtk.DialogFlags.DESTROY_WITH_PARENT, Gtk.MessageType.QUESTION, Gtk.ButtonsType.OK_CANCEL, message) dialogBox = dialogWindow.get_content_area()

PyCharm - autocomplete for Gtk3 magically stops working

三世轮回 提交于 2019-12-04 04:05:52
I have this weird problem - I'm learning Gtk3 on Windows 7 with PyCharm Community 3.4.1. When I try to import Gtk: from gi.repository import Gtk it underlines Gtk as unresolved reference, becouse it's a binary module. Then I press Alt+Enter and choose "Generate methon stubs for binary module..." and wait until it it finishes indexing. Then I happily write this simple empty window with autocomplete working correctly: class Okienko(Gtk.Window): def __init__(self): Gtk.Window.__init__(self, title='Okienko') app = Okienko() app.connect('delete-event', Gtk.main_quit) app.show_all() Gtk.main() I run

How to use CssStyleProvider in Gtkmm3

做~自己de王妃 提交于 2019-12-04 03:25:43
I'm programming in c++ with gtkmm3. I want to change some fonts in my program. I read all the things about CssStyleProvider, StyleContext in gtkmm documentation and also in gtk+ documentaion but i couldn't make it work and couldn't find any tutorial about that. I'm trying like that Glib::ustring data; data="GtkMenuBar, GtkMenuItem {font-name: Sans 6}"; /*tried with semi-colon, too*/ Glib::RefPtr<Gtk::CssProvider> asd = Gtk::CssProvider::create(); Glib::RefPtr<Gtk::StyleContext> asd2 = Gtk::StyleContext::create(); asd->load_from_data(data); asd2->add_provider(asd, 0); /*also tried different

How to send commands to pygobject virtual terminal?

泪湿孤枕 提交于 2019-12-04 02:36:51
问题 Right now I can make a terminal but the output is not used as a command. It just prints a string to the virtual terminal. from gi.repository import Gtk, GObject, Vte class TheWindow(Gtk.Window): def __init__(self): Gtk.Window.__init__(self, title="inherited cell renderer") self.set_default_size(400, 200) box = Gtk.Box(orientation=Gtk.Orientation.HORIZONTAL) v = Vte.Terminal() #v.connect ("child-exited", lambda term: gtk.main_quit()) length = len("echo \"string\"\n") v.feed("echo \"string\"\n"

Package PyGObject Python 3 program with pynsist?

☆樱花仙子☆ 提交于 2019-12-03 20:12:24
I would like to package a Python3-PyGObject program with pynsist. The repository has an example for PyGTK and it made me think that it shouldn't be too hard to change the example. The example can be found here: https://github.com/takluyver/pynsist/tree/master/examples/pygtk In this file ( https://github.com/takluyver/pynsist/blob/master/examples/pygtk/grab_files.sh ) I think one just has to grab the files targeting GTK 3 ( http://www.gtk.org/download/win32.php ): wget -O gtkbundle.zip http://win32builder.gnome.org/gtk+-bundle_3.6.4-20130921_win32.zip wget -O pygobject.exe http://sourceforge

Use glade with pygobject Gtk3

ⅰ亾dé卋堺 提交于 2019-12-03 16:32:40
问题 I am converting a script to use Gtk3 using the migration guide (Porting GTK2 to GTK3). I converted my import pygtk to a from gi.repository import Gtk and so on... I'm stuck because the glade module was loaded from module gtk: import gtk import gtk.glade but there's no way now to do that anymore. Note that I would only need a replacement for gtk.glade.XML() ... 回答1: Well, the solution is pretty obvious, after calling to Gtk.Builder() one needs to convert the old glade interface with the gtk

A sorted and filtered treemodel in Python Gtk+3..?

痞子三分冷 提交于 2019-12-03 14:34:10
I am trying to get a treemodel (a liststore in fact) that can be filtered and also sorted. I have the following piece of code self.modelfilter = self.liststore.filter_new() self.modelfilter.set_visible_func(\ self._visible_filter_function) self.treeview.set_model(self.modelfilter) where self.liststore and self.treeview are standard Gtk.ListStore and Gtk.TreeView objects that I get from a glade file, and self._visible_filter_function is a filtering function. The problem is that self.modelfilter does not seem to be sortable. When I click on the column headers (of the columns in self.treeview )

GTK+ 3.0: How to use a Gtk.TreeStore with custom model items?

♀尐吖头ヾ 提交于 2019-12-03 13:34:22
问题 I'm trying to develop a GTK application in Python and I'm really stuck with the correct usage of a gtk.TreeStore. My main problem: I've already parsed some JSON and I have my own data structure which ist basically a Python list and two kinds of objects: One represents a collection of items (collections can't be nested) and one for representing items (which might appear in the list as well as in a collection). I'm already familiar with the basic usage of a TreeStore and managed to get items