Gtk3 Hiding a dialog before heavy computation begins (pyGtk)









up vote
0
down vote

favorite












My program (pyGtk 3 based) displays a custom built dialog which collects data for a heavy computation task (running least square optimizations).



I'm issuing (in that order):



  1. a call for my_dialog.hide()

  2. Starting a spinner widget (spinner.start() )

  3. Perform the optimization

  4. Stopping the spinner

  5. Displaying results

What actually happens is that the dialog stays displayed throughout the heavy computational task and only after it is complete, it is being hidden and results are displayed without seeing the spinner.
My guess is that the thread of the dialog is slower than the computational task kicks in.



How can I make sure the dialog closes before the computational task begins without having a performance hit?



(Or am I missing a point here - please enlighten me)



Thanks.










share|improve this question





















  • If you are using Gtk3, you are not using Pygtk. Pygtk is Gtk2. Please update your question.
    – theGtknerd
    Nov 11 at 17:12










  • You need to allow the main loop to regain control. See my post here. Or maybe I should say, you need to force Gtk to do it's rendering before you do your main computation.
    – theGtknerd
    Nov 11 at 17:19










  • Post a minimal example
    – gianmt
    Nov 12 at 7:13














up vote
0
down vote

favorite












My program (pyGtk 3 based) displays a custom built dialog which collects data for a heavy computation task (running least square optimizations).



I'm issuing (in that order):



  1. a call for my_dialog.hide()

  2. Starting a spinner widget (spinner.start() )

  3. Perform the optimization

  4. Stopping the spinner

  5. Displaying results

What actually happens is that the dialog stays displayed throughout the heavy computational task and only after it is complete, it is being hidden and results are displayed without seeing the spinner.
My guess is that the thread of the dialog is slower than the computational task kicks in.



How can I make sure the dialog closes before the computational task begins without having a performance hit?



(Or am I missing a point here - please enlighten me)



Thanks.










share|improve this question





















  • If you are using Gtk3, you are not using Pygtk. Pygtk is Gtk2. Please update your question.
    – theGtknerd
    Nov 11 at 17:12










  • You need to allow the main loop to regain control. See my post here. Or maybe I should say, you need to force Gtk to do it's rendering before you do your main computation.
    – theGtknerd
    Nov 11 at 17:19










  • Post a minimal example
    – gianmt
    Nov 12 at 7:13












up vote
0
down vote

favorite









up vote
0
down vote

favorite











My program (pyGtk 3 based) displays a custom built dialog which collects data for a heavy computation task (running least square optimizations).



I'm issuing (in that order):



  1. a call for my_dialog.hide()

  2. Starting a spinner widget (spinner.start() )

  3. Perform the optimization

  4. Stopping the spinner

  5. Displaying results

What actually happens is that the dialog stays displayed throughout the heavy computational task and only after it is complete, it is being hidden and results are displayed without seeing the spinner.
My guess is that the thread of the dialog is slower than the computational task kicks in.



How can I make sure the dialog closes before the computational task begins without having a performance hit?



(Or am I missing a point here - please enlighten me)



Thanks.










share|improve this question













My program (pyGtk 3 based) displays a custom built dialog which collects data for a heavy computation task (running least square optimizations).



I'm issuing (in that order):



  1. a call for my_dialog.hide()

  2. Starting a spinner widget (spinner.start() )

  3. Perform the optimization

  4. Stopping the spinner

  5. Displaying results

What actually happens is that the dialog stays displayed throughout the heavy computational task and only after it is complete, it is being hidden and results are displayed without seeing the spinner.
My guess is that the thread of the dialog is slower than the computational task kicks in.



How can I make sure the dialog closes before the computational task begins without having a performance hit?



(Or am I missing a point here - please enlighten me)



Thanks.







python gtk3 pygtk






share|improve this question













share|improve this question











share|improve this question




share|improve this question










asked Nov 11 at 1:57









Ben Shomer

111




111











  • If you are using Gtk3, you are not using Pygtk. Pygtk is Gtk2. Please update your question.
    – theGtknerd
    Nov 11 at 17:12










  • You need to allow the main loop to regain control. See my post here. Or maybe I should say, you need to force Gtk to do it's rendering before you do your main computation.
    – theGtknerd
    Nov 11 at 17:19










  • Post a minimal example
    – gianmt
    Nov 12 at 7:13
















  • If you are using Gtk3, you are not using Pygtk. Pygtk is Gtk2. Please update your question.
    – theGtknerd
    Nov 11 at 17:12










  • You need to allow the main loop to regain control. See my post here. Or maybe I should say, you need to force Gtk to do it's rendering before you do your main computation.
    – theGtknerd
    Nov 11 at 17:19










  • Post a minimal example
    – gianmt
    Nov 12 at 7:13















If you are using Gtk3, you are not using Pygtk. Pygtk is Gtk2. Please update your question.
– theGtknerd
Nov 11 at 17:12




If you are using Gtk3, you are not using Pygtk. Pygtk is Gtk2. Please update your question.
– theGtknerd
Nov 11 at 17:12












You need to allow the main loop to regain control. See my post here. Or maybe I should say, you need to force Gtk to do it's rendering before you do your main computation.
– theGtknerd
Nov 11 at 17:19




You need to allow the main loop to regain control. See my post here. Or maybe I should say, you need to force Gtk to do it's rendering before you do your main computation.
– theGtknerd
Nov 11 at 17:19












Post a minimal example
– gianmt
Nov 12 at 7:13




Post a minimal example
– gianmt
Nov 12 at 7:13

















active

oldest

votes











Your Answer






StackExchange.ifUsing("editor", function ()
StackExchange.using("externalEditor", function ()
StackExchange.using("snippets", function ()
StackExchange.snippets.init();
);
);
, "code-snippets");

StackExchange.ready(function()
var channelOptions =
tags: "".split(" "),
id: "1"
;
initTagRenderer("".split(" "), "".split(" "), channelOptions);

StackExchange.using("externalEditor", function()
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled)
StackExchange.using("snippets", function()
createEditor();
);

else
createEditor();

);

function createEditor()
StackExchange.prepareEditor(
heartbeatType: 'answer',
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader:
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
,
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
);



);













 

draft saved


draft discarded


















StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53245195%2fgtk3-hiding-a-dialog-before-heavy-computation-begins-pygtk%23new-answer', 'question_page');

);

Post as a guest















Required, but never shown






























active

oldest

votes













active

oldest

votes









active

oldest

votes






active

oldest

votes















 

draft saved


draft discarded















































 


draft saved


draft discarded














StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53245195%2fgtk3-hiding-a-dialog-before-heavy-computation-begins-pygtk%23new-answer', 'question_page');

);

Post as a guest















Required, but never shown





















































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown

































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown







這個網誌中的熱門文章

How to read a connectionString WITH PROVIDER in .NET Core?

Node.js Script on GitHub Pages or Amazon S3

Museum of Modern and Contemporary Art of Trento and Rovereto