Tag Info

Hot answers tagged

9

The short answer is no. PyGTK is being phased out and replaced with PyGObject as the widget set upgrades from GTK+2 to GTK+3. As of Oneiric all 'native' ubuntu applications run using the GTK+3 set. On a personal note, fairly recently I started developing an application in Python, and having looked into it I decided to use Python3 with PySide (which is Qt4 ...


7

I've found a solution: use the locale Python module instead of gettext import locale from locale import gettext as _ locale.bindtextdomain('qreator', '/opt/extras.ubuntu.com/qreator/share/locale/') locale.textdomain('qreator') Thanks to Juha Sahakangas on the #gtk+ IRC channel for providing the explanation: For this particular case the locale module ...


7

Here's an example that has context from gi.repository import Gtk class Handler: def onDeleteWindow(self, *args): Gtk.main_quit(*args) def addNotebookClick(self, *args): vbox = builder.get_object("attachtome") mynote = builder.get_object("notebook1") temp = Gtk.Box() mynote.reparent(temp) ...


6

Try setting can_focus to True, if you can't give keyboard focus to the entry you won't be able to type anything into it.


6

You can also try to have a look at the help for the add command. You can do either of these: invoke the quickly help add command invoke the quickly tutorial command and browse to the add command reference From the outupt of quickly help add For instance 'quickly add dialog dialog-name' will create: A subclass of Gtk.Dialog called DialogNameDialog in ...


6

Here are precisions added to bert's answer, about the fix that worked for me : sudo add-apt-repository ppa:jfi/test sudo apt-get update sudo apt-get dist-upgrade It should then work.


5

Have a look at this example on how to connect events to callbacks in Gtk 3 and Python. In short, you use the connect() method to connect a signal name (which is emitted when an event such as a button click occurs) to a callback, which is the function that will handle your event. def __init__(self): # Other initialization code # We create a button ...


5

Use the get_object function of your builder to get the entry widget, for example entry = self.builder.get_object('entry1') print entry.get_text() This assumes that self.builder is a Gtk.Builder instance that you assigned for example in your __init__ method using the get_builder function of the helpers module in yourproject_lib


5

Yes, it's possible to do. Use gtk.Notebook.set_current_page For example: def on_button1_clicked(self, widget): self.notebook1.set_current_page(2)


5

You must add a Related Action by clicking the "..." button. Once you have added an action, disable Use Action Appearance. Then you can clear the related action and set the button to whatever you wish. You can also continue using the action as sort of standardized actions in your program. For instance, most apps will have new buttons, so with actions you ...


4

It's a bug in the current version and is fixed in trunk as far as I know. So, 2 options: Compile Glade from trunk and use that. Use this workaround: first add a new Related action (right above the label option) and set Use action appearance to False. Remove the action again if needed.


4

In your second screenshot, the Tree View Editor, you should right click each column you want to show text in and select Add child text to add a Gtk.CellRendererText to this column. The first property for the cellrenderer should be a value from the liststore you want to show in that column. Same goes for a PixBuf, Spinner, Progress, etc columns.


4

When choosing the Center on Parent position, you must also let the dialog know which window is the parent ofcourse. This can either be done in Glade, but only if the parent window is inside the same Glade-file. Or by calling this method: gtk.Window.set_transient_for(parentwindow)


4

For a Label switch on "Use markup" in the "General" tab of the Label properties. Now you can use the Pango Text Attribute Markup Language for formatting, for example H<sub>2</sub>O


4

Quickly is building the package just fine, it's simply that you haven't specified the package descriptions (the short one and the long one) for your app. Try the following: Uncomment the description and long_description lines in setup.py Add the description for your app Re-run the quickly package command That should sort it out.


4

The command is quickly add dialog dialogname and needs ran from the app directory. Note, the word "Dialog" is automatically added to the dialog name.


4

The steps below should work (from the look of your question you can start at step 5 but I've included all of them for future users). Make sure the icon image you want to use is in your_app/data/media select the widget you want to apply the image to in glade choose icon widget in edit image on the right tool button properties panel to add an image widget ...


3

I believe this is because by default (not sure if it's a GNOME-wide or GTK setting), no images are shown in buttons, so I'm not sure there is a way around it, either. This Stackoverflow question hints at stock images not shown in buttons because of that, which I assume it applies to custom images too. You might try the workaround mentioned in that question ...


3

It's a Gtk.Toolbar, see /usr/share/software-center/softwarecenter/ui/gtk3/panes/globalpane.py for how it is created.


3

The OP solved the problem(see above comment) by import os, in which case os.system(program) may be used.


3

On 12.04 quickly uses glade 3.12


3

This is actually simple. Instead of quickly design run: LANG=en quickly design. This trick works for almost every application, since they all determine your language settings on the basis of LANG (sometimes LANGUAGE or LC_MESSAGES are also significant).


3

As far as I know, this cannot be done.


3

Try to disable Use Action Appearance.


3

Removing \n from a string: newString = oldString.replace("\n", "");


2

I think flub = raw_input('Where would you like your save directory to be?') print flub Will get your variable, pass that to your GUI. Unless you change it later on in the program, it will remain until restarted / retriggered. To store that value permanently, you would need to write it somewhere lets say a text file, or set your program up to set ...


2

The issue is that file.readlines() returns a list of strings - one for each line in the file - rather than a single string. The [' and '] characters are just python's way of indicating the containing list object. It doesn't know ahead of time that your file only contains a single line. You can print the individual strings (in this case there is only one) ...


2

"on_preference_window_destroy":self.on_quit, This line is your problem. When the window is destroyed, you're calling a quit method. When you close the window, it gets destroyed, thus resulting in your quit method being called. Also, you don't want to call sys.exit(0) to exit a GTK+ application. You want to use Gtk.main_quit() instead. It ...


2

You can find some examples here, this is the only way I know: http://erikos.sweettimez.de/2011/11/23/gtk-3-theme-style-your-applications/


2

This appears to be a known issue with Glade on Ubuntu 13.10. See https://bugs.launchpad.net/ubuntu/+source/glade/+bug/1242865 The temporary fix as provided in comment #25 (https://bugs.launchpad.net/ubuntu/+source/glade/+bug/1242865/comments/25) works fine for me.



Only top voted, non community-wiki answers of a minimum length are eligible