Re: wxPython Plot always comes to focus on redraw
Thanks for the reply. The parent is a notebook. (the Plotcanvas is a page in the notebook) I tried to make the page of the notebook a panel, and then make the PlotCanvas a child of this panel, but the Plot would not show up when drawn. I may have time to make a mini program to duplicate the error in the future... On Feb 21, 2008, at 6:14 AM, Mike Driscoll wrote: On Feb 21, 2:57 am, Jacob Davis [EMAIL PROTECTED] wrote: Hi. I am using wxPython, and I have a frame that has a notebook in it. there are 3 pages in the notebook, 2 of which are Panels and 1 of which is a PlotCanvas. The data for the plot changes when I press a button that is in the frame, but not in the notebook (as designed). the button also makes the plot draw again, since the data has changed. The problem is that whenever I press my button, the focus of the notebook view area (as opposed to the tabs) changes focus to the plot. if I have multiple plots, the focus goes to that plot which was drawn last in the code. however, if I click anywhere on the panel, the page of the notebook that is supposed to be in focus is now shown in the view area of the notebook. will try to make a sample .py if anybody needs a visual, let me know pls. Thanks for any help! Jake Just a show in the dark, but is the plotcanvas object's parent a frame or a panel? If it's the frame, than that's probably what the problem is. You may want to post to the wxPython list where you'll get wx geeks to answer your question and you can learn a lot from them too. Here's a link where you can sign up: http://wxpython.org/maillist.php Mike -- http://mail.python.org/mailman/listinfo/python-list -- http://mail.python.org/mailman/listinfo/python-list
Re: wxPython Plot always comes to focus on redraw
Thanks for the reply. This is something that I tried. The documentation for SetFocus() says that it is for keyboard input and that Show() is supposed to show the window. I guess I was misusing the terminology. I tried your suggestion with SetFocus(), Show() and Raise(), with no joy. I think I will try the wxPython list. Thanks Jake On Feb 21, 2008, at 4:36 AM, Steve Holden wrote: Jacob Davis wrote: Hi. I am using wxPython, and I have a frame that has a notebook in it. there are 3 pages in the notebook, 2 of which are Panels and 1 of which is a PlotCanvas. The data for the plot changes when I press a button that is in the frame, but not in the notebook (as designed). the button also makes the plot draw again, since the data has changed. The problem is that whenever I press my button, the focus of the notebook view area (as opposed to the tabs) changes focus to the plot. if I have multiple plots, the focus goes to that plot which was drawn last in the code. however, if I click anywhere on the panel, the page of the notebook that is supposed to be in focus is now shown in the view area of the notebook. will try to make a sample .py if anybody needs a visual, let me know pls. Thanks for any help! Jake All wxWindow objects have a SetFocus() method. I am unsure why the system should be changing the focus (it's almost certainly something you are asking it to do without realizing), but the easiest way to proceed if you can't stop the focus from changing (i.e. remove the problem) is to call SetFocus() on the widget that you want to have the focus after you've finished (i.e. cure the symptom). Or perhaps it's just that I haven't understood the problem correctly. You probably didn't post the code because it's large (which is good). The correct action is to pare the program down to the smallest one you can make that demonstrates the problem, then post that. often during this process it becomes clear what the problem is! It may be that your widget relationships aren't as clean as they might be: did you produce your layout with an automated tool like wxDesigner or BoaConstrictor, or did you hack it together by hand? regards Steve -- Steve Holden+1 571 484 6266 +1 800 494 3119 Holden Web LLC http://www.holdenweb.com/ -- http://mail.python.org/mailman/listinfo/python-list -- http://mail.python.org/mailman/listinfo/python-list
wxPython Plot always comes to focus on redraw
Hi. I am using wxPython, and I have a frame that has a notebook in it. there are 3 pages in the notebook, 2 of which are Panels and 1 of which is a PlotCanvas. The data for the plot changes when I press a button that is in the frame, but not in the notebook (as designed). the button also makes the plot draw again, since the data has changed. The problem is that whenever I press my button, the focus of the notebook view area (as opposed to the tabs) changes focus to the plot. if I have multiple plots, the focus goes to that plot which was drawn last in the code. however, if I click anywhere on the panel, the page of the notebook that is supposed to be in focus is now shown in the view area of the notebook. will try to make a sample .py if anybody needs a visual, let me know pls. Thanks for any help! Jake -- http://mail.python.org/mailman/listinfo/python-list
Re: wxPython Plot always comes to focus on redraw
Jacob Davis wrote: Hi. I am using wxPython, and I have a frame that has a notebook in it. there are 3 pages in the notebook, 2 of which are Panels and 1 of which is a PlotCanvas. The data for the plot changes when I press a button that is in the frame, but not in the notebook (as designed). the button also makes the plot draw again, since the data has changed. The problem is that whenever I press my button, the focus of the notebook view area (as opposed to the tabs) changes focus to the plot. if I have multiple plots, the focus goes to that plot which was drawn last in the code. however, if I click anywhere on the panel, the page of the notebook that is supposed to be in focus is now shown in the view area of the notebook. will try to make a sample .py if anybody needs a visual, let me know pls. Thanks for any help! Jake All wxWindow objects have a SetFocus() method. I am unsure why the system should be changing the focus (it's almost certainly something you are asking it to do without realizing), but the easiest way to proceed if you can't stop the focus from changing (i.e. remove the problem) is to call SetFocus() on the widget that you want to have the focus after you've finished (i.e. cure the symptom). Or perhaps it's just that I haven't understood the problem correctly. You probably didn't post the code because it's large (which is good). The correct action is to pare the program down to the smallest one you can make that demonstrates the problem, then post that. often during this process it becomes clear what the problem is! It may be that your widget relationships aren't as clean as they might be: did you produce your layout with an automated tool like wxDesigner or BoaConstrictor, or did you hack it together by hand? regards Steve -- Steve Holden+1 571 484 6266 +1 800 494 3119 Holden Web LLC http://www.holdenweb.com/ -- http://mail.python.org/mailman/listinfo/python-list
Re: wxPython Plot always comes to focus on redraw
On Feb 21, 2:57 am, Jacob Davis [EMAIL PROTECTED] wrote: Hi. I am using wxPython, and I have a frame that has a notebook in it. there are 3 pages in the notebook, 2 of which are Panels and 1 of which is a PlotCanvas. The data for the plot changes when I press a button that is in the frame, but not in the notebook (as designed). the button also makes the plot draw again, since the data has changed. The problem is that whenever I press my button, the focus of the notebook view area (as opposed to the tabs) changes focus to the plot. if I have multiple plots, the focus goes to that plot which was drawn last in the code. however, if I click anywhere on the panel, the page of the notebook that is supposed to be in focus is now shown in the view area of the notebook. will try to make a sample .py if anybody needs a visual, let me know pls. Thanks for any help! Jake Just a show in the dark, but is the plotcanvas object's parent a frame or a panel? If it's the frame, than that's probably what the problem is. You may want to post to the wxPython list where you'll get wx geeks to answer your question and you can learn a lot from them too. Here's a link where you can sign up: http://wxpython.org/maillist.php Mike -- http://mail.python.org/mailman/listinfo/python-list