|Help with wx.NoteBook Example listed in wxPy Wiki||Aditya||11/19/12 3:17 AM|
I am pretty new to Programming. I was going through the example of wx.NoteBook as listed over here at wxPy Wiki.
However, when I run this code:
Following is the snapshot of the App. I have used the code 'as is' listed on that Wiki page.
Please help me to get rid of this.
A New Self-Learning Programming Student
|Re: [wxPython-users] Help with wx.NoteBook Example listed in wxPy Wiki||Tim Roberts||11/19/12 9:48 AM|
Have you modified the code at all? I certainly don't see that square when I run that exact code on XP, nor do I see any conceivable reason why it would occur.
Are you running this from a command line, or from inside an IDE? Which OS?
-- Tim Roberts, ti...@probo.com Providenza & Boekelheide, Inc.
|Re: [wxPython-users] Help with wx.NoteBook Example listed in wxPy Wiki||Aditya||11/19/12 10:08 AM|
I haven't modified the code at all. Using it 'as is' mentioned on that Wiki.
I am using Windows7, wxPython 220.127.116.11, Python 2.7.3. Have tried running it both from the Command Line as well as PyCharm IDE.
|Re: [wxPython-users] Help with wx.NoteBook Example listed in wxPy Wiki||grun...@gmail.com||11/19/12 10:25 AM|
Please don't top-post your replies here.
It works fine here for me as well. Win7 (US English).
Could it have something to do with your default code-page or
something? Try adding the following as the first line in the Python
script (starting in column 1):
# -*- coding: utf-8 -*-#
I don't know if it will help, but it does not hurt, here.
|Re: [wxPython-users] Help with wx.NoteBook Example listed in wxPy Wiki||Aditya||11/19/12 10:37 AM|
Doesn't help. The problem still persists.
|Re: [wxPython-users] Help with wx.NoteBook Example listed in wxPy Wiki||Robin Dunn||11/20/12 10:50 AM|
On 11/19/12 3:17 AM, Aditya wrote:> <http://wiki.wxpython.org/Simple%20wx.Notebook%20Example>.
>> * a small Black Square
> * appears on Top-Left
> * of Page 1 of the App.
>"The curse of the black spot..." ;-)
Things like that usually mean that there is some other window there,
perhaps one that is not parented properly, or that hasn't been added to
a sizer, etc. For example if one of the page panels was made a child of
the frame instead of the notebook, then it could manifest like that.
One way to figure it out would be to use the WIT. Once you've added it
to your program you can click on the Find button and then on the black
spot, and it should then be able to find that widget in the tree and
highlight it. If you can't tell from that where it is coming from then
you can assign names to the widgets (in their __init__ or by calling
SetName) and then the names will be displayed in the widget tree in the
|Re: [wxPython-users] Help with wx.NoteBook Example listed in wxPy Wiki||Aditya||11/21/12 3:06 AM|
Thanks for your time. As you suggested, I have added WIT into the code. However, I still can't figure out the problem. Everything seems well parented to me and Sizers seem to be used appropriately. Following is the snapshot of what WIT shows when I use its Find feature.
I should also let you know, that if I remove Page1 from the code completely; ie; if I comment out Line 33 and Line 38 of the code listed on the wiki; then this Black Spot appears on Page 2. And disappears once I navigate to other pages.
Similarly, if I make any of the pages as Default; ie; if I make Page 3 as default by modifying Line 40 as:
nb.AddPage(page3, "Page 3", select=True)
Then, Black Spot appears in Page3 and disappears once I start navigating.
In Short, this Spot appears on the Page that is first displayed by the app and disappears once we navigate to other Pages.
|Re: [wxPython-users] Help with wx.NoteBook Example listed in wxPy Wiki||Robin Dunn||11/21/12 9:25 AM|
>Ok, the other possibility is that it is simply a refresh glitch where
Windows thinks that that square has already been drawn and so it's
excluded from the initial paint event. That can sometimes happen when
windows are first being created and shuffled around by the initial
layout. Try adding "wx.CallAfter(nb.Refresh)" to the end of
MainFrame.__init__. That will cause an extra paint event to be
delivered to the notebook and its visible children right after the
|Re: [wxPython-users] Help with wx.NoteBook Example listed in wxPy Wiki||Tim Roberts||11/21/12 9:26 AM|
Aditya wrote:However, your screen shot does show us something that you didn't mention
before: your desktop background color is black. Thus, rather than being
a black square drawn on top of everything else, what's likely happening
here is that the background color is showing through. You could test
that theory by changing the background color temporarily.
My best guess is that there is a cursor bug in your display driver.
It's restoring the wrong location after your window is drawn. By any
chance, is this running in a VM, or a Remote Desktop session, or a
TeamViewer session, or a GotoMyPC session, or one of the VNC clones? If
so, try this on real hardware and I'll bet you $100 it goes away.
|Re: [wxPython-users] Help with wx.NoteBook Example listed in wxPy Wiki||Robin Dunn||11/21/12 9:49 AM|
On 11/21/12 9:26 AM, Tim Roberts wrote:I saw it on one of my Windows PC too, it's not the background showing
through and has no discernible relationship with the cursor. It
initially starts out at the frame's client area (0,0) position and then
is shifted to the notebook's client area (0,0) after the initial layout.
My theory is that before everything is positioned and sized the panel,
the notebook and all the page windows are stacked on top of each other
at the frame's upper left corner and sized at about (20,20) with the
first page on top and all the page windows are shown (but not visible
because they are under the first page). When the notebook gets sized to
fill the panel it hides the other page windows and resizes/repositions
the first page window to be in the right place, but since it was on top
before Windows thinks that the (20,20) in the upper left corner has
already been painted and clips it out of the refresh region, but it
either never was painted or something (perhaps the themed drawing of the
notebook tabs) drew over that area before the page window was moved to
the correct position.
We used to see something similar in the demo when adding/removing
notebook pages when the current demo sample was changed. In that case
some Freeze/Thaw calls took care of it
|Re: [wxPython-users] Help with wx.NoteBook Example listed in wxPy Wiki||Aditya||11/23/12 3:41 AM|
First of all, extremely sorry for a late reply. My Internet Connection has been giving lots of problems for the last 2 days.
Now coming to the curse of the Black Spot. It's gone... The trick of refreshing the NoteBook by using wx.CallAfter(nb.Refresh) worked. Now, my 1st GUI App, which I am developing using that base code, looks pretty. Thanks for your help.
I would request you to update the code on that wiki providing the reasons thereof. Thank you once again.
|Re: [wxPython-users] Help with wx.NoteBook Example listed in wxPy Wiki||Aditya||11/23/12 3:46 AM|
No my Desktop background wasn't Black. I had edited the image so that the focus remains on the problem rather than the background. Neither am I running this in a VM or other VNC clones. Using the main Window 7 Desktop PC for this.
Do you still want to transfer $100 to my account. Let me know if you wish (or, has the offer expired in these last 2 days) :-)
|Re: [wxPython-users] Help with wx.NoteBook Example listed in wxPy Wiki||Tim Roberts||11/24/12 1:20 PM|
I'm sorry, but I'm afraid you didn't satisfy the pre-conditions -- you were already running this on real hardware.
I do admit that my analysis was wrong...
|Re: [wxPython-users] Help with wx.NoteBook Example listed in wxPy Wiki||Nathan McCorkle||9/15/14 3:56 PM|
I was getting weird black spots and rectangles on start-up of a Notebook-based GUI, calling wx.CallAfter(self.nb.Refresh) fixed the problem, albeit with some discernible flicker. I also tried using the WIT's Find button then clicked on the black areas, but the WIT just showed the Panel I'd added to the Notebook (properly parented).
Using wx-3.0.1-msw-classic on WinXP