GTK progress bar not working properly with pulse()

L

lamthierry

My python file(progressbar.py) looks like the following:

pbar = gtk.ProgressBar()

def updateBar(percentage):
print percentage
pbar.pulse()

class ProgressBar:
def __init__(self):
# other gui codes

align.add(pbar)
pbar.show()

My C++ codes look like the following:

for ( int percent = 0; percent < 100; percent++ )
{
PyObject* importModule = PyImport_ImportModule("progressbar");

if ( importModule == NULL )
printf("not good\n");
PyObject* callResult = PyObject_CallMethod(importModule,
"updateBar", "i", percent, NULL);
if ( callResult == NULL )
printf("not good enough\n");

Py_XDECREF(importModule);
}

I run the above C++ code from python by clicking a button. The problem
is that when I print the percentage from the python side, it works
fine, but when I call the pulse() method for ProgressBar, nothing gets
updated on my GUI. Do I have to do anything else with the pbar object
to make it display properly?
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,744
Messages
2,569,483
Members
44,903
Latest member
orderPeak8CBDGummies

Latest Threads

Top