FAQ Database Discussion Community


make gtk widget fill parent window

xml,gtk,alignment,pygtk
I am new to gtk programming (but experienced with python). I have a window that has a button widget child. What do I have to do if I want the button to completely fill the window? By the way, this would be extremely easy to do with xml (fill-parent), is...

Python3 gi: GtkTextBuffer core dump

python,python-3.x,gtk,pygtk,glade
Using Python3 with gi.repository.Gtk, I'm trying to display multiple text lines inside a GtkTextView via a GtkTextBuffer. Basically, I'm dynamically adding lines using an _addLine method, which updates the text buffer that way (self._lines is an array and self._textBuffer is a GtkTextBuffer): def _addLine(self, text): if len(self._lines) == self._maxLines: self._lines...

How do I disable edition of a PyGtk Combobox?

python,gtk,pygtk
I want the user to be able to select the items on a PyGTK ComboBox, while not being able to write in the combo. He/She should be allowed just to select one of the items. So I can't use set_active(False), for it will disable the combo. How can I do...

Wrap pygtk Window after destroying widgets

resize,widget,window,pygtk,wrap
I'm creating an app using pygtk with different mode: mode "normal" which use a PathBrowse and a ComboBox mode "append" which destroy the PathBrowse and the combo in the Window and add others like CheckBox and Labels But in append mode, the fact of destroying widgets bigger than the new...

Paint on Transparent window with HeaderBar Python and Gtk3

python,gtk,pygtk
I have a little problem with the following code. It creates a GtkWindow, make it paintable so I can draw on it with cairo on draw events. Then I add a GtkHeaderBar and a simple button widget. from gi.repository import Gtk import cairo def draw_callback(widget,cr): if widget.transparency: cr.set_source_rgba(0,0,0,0.5) else: cr.set_source_rgb(0,0,0)...

Check box active and diactive in pythonGTK using glade

python,gtk,pygtk,glade
I want to write the code for the following image: I want to tell if tick is true be able to enter user and pass if the tick of Login is false not be able to enter user and pass. This is xml glade file: <?xml version="1.0" encoding="UTF-8"?> <interface> <!--...

GTK Python display message for given time

python-3.x,gtk,pygtk
I am doing a simple GUI for Python program. In one function, I want to display a text message for a few seconds and then continue. My code for this part is: self.message.set_text('This is a message') time.sleep(3) self.message_box.destroy() # call another function My issue is, the program firstly sleep and...

Logging messages to pygtk.entry

python,python-2.7,logging,gtk,pygtk
I am currently developing gtk GUI for my python Application. I want to implement simple text entry which will contain all logging messages of application (something like console logging window in GUI). Unfortunately, I was only able to create logging handler that will print logging messages to a file or...

install matplotlib with pip and when pygtk is in non standard location

python,matplotlib,pygtk
I have installed PyGTK 2.24.0 in /software/pygtk-2.24.0/gcc directory. Is there any way without rewrite the setup program how to install matplotlib with pip? Simple pip install matplotlib builds matplotlib without GTK support. I have even tried to put /software/pygtk-2.24.0/gcc and /software/pygtk-2.24.0/gcc/lib/python2.7/site-packages to setup.cfg basedirlist variable and also in the list...

GtkDialog mapped without a transient parent

gtk,pygtk,glade,pygobject
I have a GUI built in Glade (3.18) which is called by a Python 3 program (using PyGObject). I get a lot of warnings when running the program (Fedora 21) that say: Gtk-Message: GtkDialog mapped without a transient parent. This is discouraged. How can I fix this warning? I tried...

Pygtk mount file through sftp without username and password dialog?

gtk,sftp,pygtk
I am trying to mount a directory via sftp in pygtk. Since I already have the username and password stored in variables, I don't want to get a dialog box asking for the username and password. I am using the following code: def error_printer(o,r) try: o.mount_enclosing_volume_finish(r) except gio.Error, e: print...

How can i unlock Gtk button event

python-2.7,pygtk,gtk3
When i click on some button, the entire application stay locked waiting a result from the method, to return something.. So, i have one Gtk.Button, and i connected him to a function, for example on_button_clicked: button = Gtk.Button() button.connect('clicked', on_button_clicked) the function on_button_clicked look like this: def on_button_clicked(widget): func1() func2()...

Pygtk: How do I change the treestore color of a row?

pygtk
Currently I am developing a tool by using Python with Gtk+ library. And I met an issue here as $subject. Is there any effective way for changing the treestore "1/8"'s background color to red ? Something like the below image: http://imagebin.ca/v/1pZgJ61cWi9D I use treestore.set_value to change it, but unfortunately it...

PyGtk: How to unpack boxes

python,pygtk
I'm looking for a way to unpack boxes again. So having e.g. a construct like that: # ... vbox = gtk.VBox() hbox = gtk.HBox() vbox.pack_start(hbox,False, False, 0) label = gtk.Label("Please insert text:") entry = gtk.Entry() hbox.pack_start(label,False, False, 0) hbox.pack_end(entry,False, False, 0) vbox.show_all() # ... I'm wondering how I could remove...

close sub-window without closing main window PyGTK in python

python,user-interface,pygtk
I am creating a gui in python with PyGtk and I would like to create a sub-window that branches off from my main window but unlike a dialog the user will be able to interact with the main window without having to close the sub-window. The following code was demonstrated...

How to create a dropdown from a gtk.Entry's icon?

pygtk
I have a gtk.Entry with an icon after the text, intending to be a text search field: What I'm trying to do is to display a dropdown (i.e. a gtk.ComboBox) when the user clicks on the icon, to choose the type of search. A mock of that feature would be:...

Vertical Scroll Bar in PyGTK

python,user-interface,gtk,pygtk
I made a combined text editor-terminal in Python using GTK. I want users to be able to control the amount of vertical space each occupies in the same window. I don't know how to do that, I need help, the suggested solutions I've searched online have not worked. # UI...

Python Gtk3: “mark-set” signal of a Gtk.Textbuffer

python,pygtk,gtk3
I am trying to understand a strange behaviour of the mark-set signal emitted by a Gtk.Textbuffer in a python program. In fact this signal is emitted (in my case) multiple times for a single user action. This sounds not logical to me and I didn't find any reference to this...

Action during button pressed in Python

python,events,button,pygtk
I am a beginner when it gomes to GUI programming with Python so I am guessing my problem has a simple solution even if I have not found a solution searching with google, wikis, documentation, examples ... What I am trying to achive is that a value in an entry...

Any way to make a Python GTK window quit automatically?

python,pygtk
I'm writing a code that I would like to repeat automatically, and for the most part I have it. If I use a while loop I can get it to repeat, but I have to close the window automatically for it to work. Is there any way I can get...