The GUI does not appear when I run my program

Asked by Charles Edward Pax

Here is part of a message sent to me on

when i make the python files with your program, and then start the .py file, i get this in the terminal:

this function will run one on startup

and nothing happens...
then i tested the example file which is included, that gives the same line, but the example gui starts atleast...

i'm using the 0.4 version...

Question information

English Edit question
Gladex Edit question
No assignee Edit question
Solved by:
Charles Edward Pax
Last query:
Last reply:
Revision history for this message
Charles Edward Pax (pax) said :

Take a look at your callbacks file. There should be a function like this:

def init(wtree):
 print "this function will run one on startup"

This is telling you that whatever code you put in this function will be executed when the program starts.

For Gladex to create templates for functions, you must first define your callback functions in Glade (I'm using version 3.4):
1) Select a widget that will call a function (e.g. a button)
2) Select the "Signals" tab
3) Select a callback signal you want to use.

Then save it an run it through Gladex again. You will see in the callbacks file a templated function for each signal you select.

The non-visible application window issue can easily be solved. In Glade, do the following:
1) From the widget list, select the widget representing the main window of you application.
2) Go to the "Common" tab.
3) Locate the "Visible" option and set to "Yes"

Then save and run it through Gladex. When you run your program your GUI should now appear.

Revision history for this message
Timo Vanwynsberghe (timovwb) said :

hello, i'm the one who sent you this question through the ubuntuforums...

i have another questions, it's about the callbacks file, so i'll go further in here if you don't mind?

i have succesfully created a button in glade, called dcdbas...added the signal, and ran it through gladex...
as you can see below, i can print out a message, and i see the message in a terminal when i press the button, so thats ok i think...

def on_dcdbas_clicked(widget, data, wtree):
 print "Modprobing dcdbas..."

now my question, so i can print a message when i press the button, but it also needs to execute a command when i press it: (gk)sudo modprobe dcdbas
how does this work?

thanks in advance!

Revision history for this message
Christopher Pax (paxmanchris) said :

I often use:
import commands

a = commands.getoutput("echo 'hello' ")

print a

the output will be:

the more offical way to run a command is:

import os

os.system("echo 'hello'")

though I am unsure how you get the stdout of the message. so I use the former.

I hope this answers your question.

Revision history for this message
Charles Edward Pax (pax) said :

To keep information organized and easy to find, a new question should be asked as its own unique entity. Conversation moved to Question 18105 (