Demo & Others

Hi Robin & All,

    I was surfing through the latest and greatest wxPython 2.9.3.1,
and I found a few oddities plus a possible goody:

1) The main wx.TreeCtrl looks a bit strange, the line height is way
too short for the big items (i.e. items with big font) although the
style wx.TR_HAS_VARIABLE_ROW_HEIGHT has been specified (see the
screenshot demo.png). If you switch to use CustomTreeCtrl, the line
height is what it is supposed to be.

2) In the wx.Slider demo, I just added the style wx.SL_INVERSE to the
demo. Well, I must say that what I found (attached as slider.png) is a
bit counter-intuitive... The slider value label is correctly shown as
inverted, but what about the slider min/max labels? They don't make
any sense to me.

3) The wx.ListBook still doesn't make enough room to display the
entire labels for the various page tabs (see that you have to scroll
horizontally to see that the page names are actually "Aquamarine",
"Cadet Blue" and so on).

4) When I try to load the PDFViewer demo I get this:

C:\Python27\Lib\site-packages\wx-2.9.3-msw\wxPython2.9 Docs and
Demos\demo>python Main.py
Traceback (most recent call last):
  File "Main.py", line 2225, in OnSelChanged
    self.LoadDemo(itemText)
  File "Main.py", line 2249, in LoadDemo
    self.demoModules = DemoModules(demoName)
  File "Main.py", line 1316, in __init__
    self.LoadFromFile(modOriginal, GetOriginalFilename(name))
  File "Main.py", line 1327, in LoadFromFile
    self.LoadFromSource(modID, file.read())
  File "Main.py", line 1333, in LoadFromSource
    self.LoadDict(modID)
  File "Main.py", line 1346, in LoadDict
    self.modules[modID][4] = DemoError(sys.exc_info())
  File "Main.py", line 1445, in __init__
    line = line.strip()
AttributeError: 'NoneType' object has no attribute 'strip'

I am not sure (yet) what the problem is but I will investigate tomorrow.

5) I get an AttributeError when trying to load the ActiveX_FlashWindow
demo (see attached flash.png). Can it be because the SWF movie was not
included in the distribution?

6) I get this from the ActiveX_PDFWindow when trying to load a PDF file:

# Generating comtypes.gen._05BFD3F1_6319_4F30_B752_C7A22889BCC4_0_1_0
Traceback (most recent call last):
  File "ActiveX_PDFWindow.py", line 135, in OnLoadButton
    self.pdf.LoadFile(dlg.GetPath())
  File "C:\Python27\lib\site-packages\wx-2.9.3-msw\wx\lib\pdfwin.py",
line 70, in LoadFile
    return self.ctrl.LoadFile(fileName)
  File "C:\Python27\lib\site-packages\comtypes\__init__.py", line 264,
in __getattr__
    raise AttributeError(name)
AttributeError: LoadFile

7) The MediaCtrl sample fails to run, probably because of the missing
movie? (See attached media.png).

8) I get the same error as (4) when I try to run the Cairo demos, but
I guess I will need to onstall the cairo stuff myself. Am I correct?

9) RendererNative: on what platform the + and - images are drawn like
the ones I am seeing (attached as renderer_native_tree.png)? Maybe I
am missing something, but my Windows machine doesn't show tree item
buttons like these...

10) (Goody): Now that I saw the beautiful wx.html2, how about we start
and include somehow the Phoenix docs in the demo itself? I mean,
wx.html could never ever handle the CSS-based Phoenix docs, but it
appears to me that wx.html2 can render them beautifully. Do you think
it would be worth trying and display the Phoenix docs somewhere inside
the "Overview" tab for each widget (if available)?

···

--
Andrea.

"Imagination Is The Only Weapon In The War Against Reality."
http://xoomer.alice.it/infinity77/

import PyQt4.QtGui

Traceback (most recent call last):
File "<interactive input>", line 1, in <module>
ImportError: No module named PyQt4.QtGui

import pygtk

Traceback (most recent call last):
File "<interactive input>", line 1, in <module>
ImportError: No module named pygtk

import wx

My configuration is
Windows 7 Service Pack 1 (64 bit)
Python is version 2.7.2
wxPython is version 2.9.3.1

  1. I see the same restricted height “wxPython Overview” text.

  2. I agree the wx.Slider min/max values should be interchanged when using the style wx.SL_INVERSE

  3. The ListBook labels are fully displayed, see attached.

  4. The PDFViewer start up OK.

  5. The ActiveX_FlashWindow starts up OK

  6. The ActiveX_PDFWindow loads a file OK

  7. The MediaCtrl sample fails to run - same “Unsupported format” message

  8. The Cairo demos run OK. The libraries are all included by Robin. The only problem I have had is that under Win7 x64 the Cairo libraries must be in the current directory when imported, not just in the Python path.

  9. The RendererNative screen I see is attached. I don’t know if the + and - buttons look as they should but the relative sizes of text and the drawings are different to Andrea’s (I set my demo screen size to match his in 1 above). For example Andrea’s Header Button texts overflow the buttons.
    Hope this helps
    Regards

David Hughes
Forestfield Software

···

On Sunday, March 11, 2012 8:26:47 PM UTC, Infinity77 wrote:

  1. The main wx.TreeCtrl looks a bit strange, the line height is way
    too short for the big items
  1. In the wx.Slider demo, I just added the style wx.SL_INVERSE to the
    demo. Well, I must say that what I found (attached as slider.png) is a
    bit counter-intuitive… The slider value label is correctly shown as
    inverted, but what about the slider min/max labels? They don’t make
    any sense to me.
  1. The wx.ListBook still doesn’t make enough room to display the
    entire labels for the various page tabs (see that you have to scroll
    horizontally to see that the page names are actually “Aquamarine”,
    “Cadet Blue” and so on).
  1. When I try to load the PDFViewer demo I get this:

Traceback (most recent call last): …
I am not sure (yet) what the problem is but I will investigate tomorrow.

  1. I get an AttributeError when trying to load the ActiveX_FlashWindow
    demo (see attached flash.png). Can it be because the SWF movie was not
    included in the distribution?
  1. I get this from the ActiveX_PDFWindow when trying to load a PDF file:

Traceback (most recent call last): ,
7) The MediaCtrl sample fails to run, probably because of the missing
movie?

  1. I get the same error as (4) when I try to run the Cairo demos, but
    I guess I will need to onstall the cairo stuff myself. Am I correct?
  1. RendererNative: on what platform the + and - images are drawn like
    the ones I am seeing (attached as renderer_native_tree.png)? Maybe I
    am missing something, but my Windows machine doesn’t show tree item
    buttons like these…


Andrea.

Hi Robin& All,

     I was surfing through the latest and greatest wxPython 2.9.3.1,
and I found a few oddities plus a possible goody:

1) The main wx.TreeCtrl looks a bit strange, the line height is way
too short for the big items (i.e. items with big font) although the
style wx.TR_HAS_VARIABLE_ROW_HEIGHT has been specified (see the
screenshot demo.png). If you switch to use CustomTreeCtrl, the line
height is what it is supposed to be.

It looks like the wxTR_HAS_VARIABLE_ROW_HEIGHT style is only checked in the generic treectrl code, and doesn't apply to the native widget used on wxMSW.

We currently have this in the demo's Main.py:

         # The old native treectrl on MSW has a bug where it doesn't
         # draw all of the text for an item if the font is larger than
         # the default. It seems to be clipping the item's label as if
         # it was the size of the same label in the default font.
         if 'wxMSW' not in wx.PlatformInfo or wx.GetApp().GetComCtl32Version() >= 600:

So it appears that it was expected that this will work if the themed version of the common controls DLL is being used, but apparently that has changed. I'll tweak that code a bit.

2) In the wx.Slider demo, I just added the style wx.SL_INVERSE to the
demo. Well, I must say that what I found (attached as slider.png) is a
bit counter-intuitive... The slider value label is correctly shown as
inverted, but what about the slider min/max labels? They don't make
any sense to me.

Please create a ticket about this one, the labels should definitely be inverted too.

3) The wx.ListBook still doesn't make enough room to display the
entire labels for the various page tabs (see that you have to scroll
horizontally to see that the page names are actually "Aquamarine",
"Cadet Blue" and so on).

It looks like you may have your Windows preferences set to use a larger than normal font. The problem is probably related to that, perhaps the larger default system font is not being used when measuring the text to determine the needed size, or something like that. Please create a ticket about this one too.

4) When I try to load the PDFViewer demo I get this:

C:\Python27\Lib\site-packages\wx-2.9.3-msw\wxPython2.9 Docs and
Demos\demo>python Main.py
Traceback (most recent call last):
   File "Main.py", line 2225, in OnSelChanged
     self.LoadDemo(itemText)
   File "Main.py", line 2249, in LoadDemo
     self.demoModules = DemoModules(demoName)
   File "Main.py", line 1316, in __init__
     self.LoadFromFile(modOriginal, GetOriginalFilename(name))
   File "Main.py", line 1327, in LoadFromFile
     self.LoadFromSource(modID, file.read())
   File "Main.py", line 1333, in LoadFromSource
     self.LoadDict(modID)
   File "Main.py", line 1346, in LoadDict
     self.modules[modID][4] = DemoError(sys.exc_info())
   File "Main.py", line 1445, in __init__
     line = line.strip()
AttributeError: 'NoneType' object has no attribute 'strip'

I am not sure (yet) what the problem is but I will investigate tomorrow.

All of the layers in the traceback are in Main.py, so it seems to be something about the demo framework rather than the specific sample...

5) I get an AttributeError when trying to load the ActiveX_FlashWindow
demo (see attached flash.png). Can it be because the SWF movie was not
included in the distribution?

Check your .../demo/data folder, the swf file should be there.

6) I get this from the ActiveX_PDFWindow when trying to load a PDF file:

# Generating comtypes.gen._05BFD3F1_6319_4F30_B752_C7A22889BCC4_0_1_0
Traceback (most recent call last):
   File "ActiveX_PDFWindow.py", line 135, in OnLoadButton
     self.pdf.LoadFile(dlg.GetPath())
   File "C:\Python27\lib\site-packages\wx-2.9.3-msw\wx\lib\pdfwin.py",
line 70, in LoadFile
     return self.ctrl.LoadFile(fileName)
   File "C:\Python27\lib\site-packages\comtypes\__init__.py", line 264,
in __getattr__
     raise AttributeError(name)
AttributeError: LoadFile

What version of Adobe Acrobat do you have installed? You may also want to check that you have a recent version of comtypes installed too.

7) The MediaCtrl sample fails to run, probably because of the missing
movie? (See attached media.png).

I've seen this one in my recent builds too, but I haven't investigated it any further yet.

8) I get the same error as (4) when I try to run the Cairo demos, but
I guess I will need to onstall the cairo stuff myself. Am I correct?

That used to be the case but the DLLs should be included now, check your wx package dir. The DLLs were added to the distribution mainly because you can now use the Cairo backend for wxGraphicsContext on MSW. However if you do not also have the PyCairo package installed then the Cairo demos will still fail, although they should be displaying a message panel in the demo in that case telling you that it could not import PyCairo.

Perhaps the real problem you are having for this and #4 (it will also display a message panel if it can't import the required 3rd party packages) is that there is some conflict or other problem with wx.lib.msgpanel on your computer?

9) RendererNative: on what platform the + and - images are drawn like
the ones I am seeing (attached as renderer_native_tree.png)? Maybe I
am missing something, but my Windows machine doesn't show tree item
buttons like these...

This could also be related to using a larger than normal system font setting. The demo simply passes a rectangle size 16x16 to the renderer method, and it is the system theme that does the actual drawing. When zooming in on the screen shots and counting pixels it looks like Andrea's is drawing the full 16x16 but David's is drawing at about 10x10.

10) (Goody): Now that I saw the beautiful wx.html2, how about we start
and include somehow the Phoenix docs in the demo itself? I mean,
wx.html could never ever handle the CSS-based Phoenix docs, but it
appears to me that wx.html2 can render them beautifully. Do you think
it would be worth trying and display the Phoenix docs somewhere inside
the "Overview" tab for each widget (if available)?

Yes, something like that could certainly be done. I wouldn't put too much effort into it yet however as I've been thinking that it would be nice to clean up and refactor the main part of the demo to make it better designed, less kludgy and more easily maintained and enhanced. I've got a few more Phoenix things to do before I'll be ready to spend some time on that however.

Otherwise my thoughts/plans so far regarding distribution of the docs is to provide .chm files (and/or .zip files in htb format) so then the index and table of contents are more usable, and there is also the possibility of including additional 'books,' such as the Python documentation. There are good CHM readers on all platforms now, and if/when we get something like HtmlHelpController using the new HTML2 renderer then we can provide our own doc browser app like I used to do for Mac (a simple 45-line program!) and probably also have the demo open pages there using the help framework with just some very minor tweaks. The plain HTML files could also be available for download of course, but perhaps only as a secondary option and the chm would be the one we bundle or have first on the list on the downloads page.

···

On 3/11/12 1:26 PM, Andrea Gavana wrote:

--
Robin Dunn
Software Craftsman

Hi Robin,

Hi Robin& All,

I was surfing through the latest and greatest wxPython 2\.9\.3\.1,

and I found a few oddities plus a possible goody:

2) In the wx.Slider demo, I just added the style wx.SL_INVERSE to the
demo. Well, I must say that what I found (attached as slider.png) is a
bit counter-intuitive... The slider value label is correctly shown as
inverted, but what about the slider min/max labels? They don't make
any sense to me.

Please create a ticket about this one, the labels should definitely be
inverted too.

It appears someone else had already done it, and the issue is marked
as "fixed" since SVN 70048 (3 months ago):

http://trac.wxwidgets.org/ticket/13416

So I guess the next wxPython release will have the fix in it.

3) The wx.ListBook still doesn't make enough room to display the
entire labels for the various page tabs (see that you have to scroll
horizontally to see that the page names are actually "Aquamarine",
"Cadet Blue" and so on).

It looks like you may have your Windows preferences set to use a larger than
normal font. The problem is probably related to that, perhaps the larger
default system font is not being used when measuring the text to determine
the needed size, or something like that. Please create a ticket about this
one too.

Done:

http://trac.wxwidgets.org/ticket/14097

4) When I try to load the PDFViewer demo I get this:

C:\Python27\Lib\site-packages\wx-2.9.3-msw\wxPython2.9 Docs and
Demos\demo>python Main.py
Traceback (most recent call last):
File "Main.py", line 2225, in OnSelChanged
self.LoadDemo(itemText)
File "Main.py", line 2249, in LoadDemo
self.demoModules = DemoModules(demoName)
File "Main.py", line 1316, in __init__
self.LoadFromFile(modOriginal, GetOriginalFilename(name))
File "Main.py", line 1327, in LoadFromFile
self.LoadFromSource(modID, file.read())
File "Main.py", line 1333, in LoadFromSource
self.LoadDict(modID)
File "Main.py", line 1346, in LoadDict
self.modules[modID][4] = DemoError(sys.exc_info())
File "Main.py", line 1445, in __init__
line = line.strip()
AttributeError: 'NoneType' object has no attribute 'strip'

I am not sure (yet) what the problem is but I will investigate tomorrow.

All of the layers in the traceback are in Main.py, so it seems to be
something about the demo framework rather than the specific sample...

5) I get an AttributeError when trying to load the ActiveX_FlashWindow
demo (see attached flash.png). Can it be because the SWF movie was not
included in the distribution?

Check your .../demo/data folder, the swf file should be there.

6) I get this from the ActiveX_PDFWindow when trying to load a PDF file:

# Generating comtypes.gen._05BFD3F1_6319_4F30_B752_C7A22889BCC4_0_1_0
Traceback (most recent call last):
File "ActiveX_PDFWindow.py", line 135, in OnLoadButton
self.pdf.LoadFile(dlg.GetPath())
File "C:\Python27\lib\site-packages\wx-2.9.3-msw\wx\lib\pdfwin.py",
line 70, in LoadFile
return self.ctrl.LoadFile(fileName)
File "C:\Python27\lib\site-packages\comtypes\__init__.py", line 264,
in __getattr__
raise AttributeError(name)
AttributeError: LoadFile

What version of Adobe Acrobat do you have installed? You may also want to
check that you have a recent version of comtypes installed too.

For Adobe, I have Reader X (10.1.2). The comtypes version I have is
the latest available on SourceForge (0.6.2)... I guess then my
computer has some inherent issue with Flash and Acrobat :frowning:

7) The MediaCtrl sample fails to run, probably because of the missing
movie? (See attached media.png).

I've seen this one in my recent builds too, but I haven't investigated it
any further yet.

8) I get the same error as (4) when I try to run the Cairo demos, but
I guess I will need to onstall the cairo stuff myself. Am I correct?

That used to be the case but the DLLs should be included now, check your wx
package dir. The DLLs were added to the distribution mainly because you can
now use the Cairo backend for wxGraphicsContext on MSW. However if you do
not also have the PyCairo package installed then the Cairo demos will still
fail, although they should be displaying a message panel in the demo in that
case telling you that it could not import PyCairo.

Perhaps the real problem you are having for this and #4 (it will also
display a message panel if it can't import the required 3rd party packages)
is that there is some conflict or other problem with wx.lib.msgpanel on your
computer?

Well, I don't remember touching anything in wx.lib since I installed
2.9.3.1, but that might be the reason... I'll try and see if I can
work it out.

9) RendererNative: on what platform the + and - images are drawn like
the ones I am seeing (attached as renderer_native_tree.png)? Maybe I
am missing something, but my Windows machine doesn't show tree item
buttons like these...

This could also be related to using a larger than normal system font
setting. The demo simply passes a rectangle size 16x16 to the renderer
method, and it is the system theme that does the actual drawing. When
zooming in on the screen shots and counting pixels it looks like Andrea's is
drawing the full 16x16 but David's is drawing at about 10x10.

Yes, the problem is exactly that. I am using the Windows 7 "Larger
Font" settings and the whole wx.RendererNative funny-looking sample is
a side-effect of this setting. But that's OK now that I know the
reason :slight_smile:

10) (Goody): Now that I saw the beautiful wx.html2, how about we start
and include somehow the Phoenix docs in the demo itself? I mean,
wx.html could never ever handle the CSS-based Phoenix docs, but it
appears to me that wx.html2 can render them beautifully. Do you think
it would be worth trying and display the Phoenix docs somewhere inside
the "Overview" tab for each widget (if available)?

Yes, something like that could certainly be done. I wouldn't put too much
effort into it yet however as I've been thinking that it would be nice to
clean up and refactor the main part of the demo to make it better designed,
less kludgy and more easily maintained and enhanced. I've got a few more
Phoenix things to do before I'll be ready to spend some time on that
however.

Otherwise my thoughts/plans so far regarding distribution of the docs is to
provide .chm files (and/or .zip files in htb format) so then the index and
table of contents are more usable, and there is also the possibility of
including additional 'books,' such as the Python documentation. There are
good CHM readers on all platforms now, and if/when we get something like
HtmlHelpController using the new HTML2 renderer then we can provide our own
doc browser app like I used to do for Mac (a simple 45-line program!) and
probably also have the demo open pages there using the help framework with
just some very minor tweaks. The plain HTML files could also be available
for download of course, but perhaps only as a secondary option and the chm
would be the one we bundle or have first on the list on the downloads page.

Good then, it seems like we are in a good shape with Phoenix!

Andrea.

"Imagination Is The Only Weapon In The War Against Reality."
http://xoomer.alice.it/infinity77/

···

On 12 March 2012 23:24, Robin Dunn wrote:

On 3/11/12 1:26 PM, Andrea Gavana wrote: