wx.MAXIMIZE directive not heeded by py2exe executable

Hi,

I have condensed my problem in the following lines of code,

import wx

class MainWindow(wx.Frame):

def init(self,parent,id,title):

    wx.Frame.__init__(self,parent,wx.ID_ANY, title, size = (-1,-1),
                      style=wx.DEFAULT_FRAME_STYLE|
                      wx.NO_FULL_REPAINT_ON_RESIZE |wx.MAXIMIZE)
   
    self.Show(True)

if name == “main”:
app = wx.App(0)

frame = MainWindow(None, -1, “Test”)
app.MainLoop()

If I run this script using python 2.4 on windows XP, I get an empty frame displayed maximized - as expected. However, if I convert this into an executable using this setup.py

from distutils.core import setup
import py2exe

setup(windows=[“testframe.py”],)

then, the window which appears on running the executable is not maximized. It runs as if I have not specified the wx.MAXIMIZE flag at all?

Can someone please help me understand why?

Interestingly, if I run the script from ipython, it also does not show the window maximized.

thanks.

Rama

Hello Rama,

If I run this script using python 2.4 on windows XP, I get an empty frame

displayed maximized - as expected. However, if I convert this into an executable

using this setup.py

Well, this doesn’t answer directly to your question, but you may try to call:

self.Maximize()

before calling Show() on your frame. It works here on XP. Probably Robin has a better answer about this issue.

HTH.

Andrea.

···

Andrea Gavana
(gavana@kpo.kz)

Reservoir Engineer

KPDL

4, Millbank

SW1P 3JA London

Direct Tel: +44 (0) 20 717 08936

Mobile Tel: +44 (0) 77 487 70534

Fax: +44 (0) 20 717 08900

Web:
http://xoomer.virgilio.it/infinity77

¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯

Thanks, Andrea. This works on my system as well and should do as a workaround for now.

However, I am still interested in knowing the reason behind this.

thanks,

Rama

···

On 21/08/06, Gavana, Andrea gavana@kpo.kz wrote:

Hello Rama,

If I run this script using python 2.4 on windows XP, I get an empty frame

displayed maximized - as expected. However, if I convert this into an executable

using this setup.py

Well, this doesn’t answer directly to your question, but you may try to call:

self.Maximize()

before calling Show() on your frame. It works here on XP. Probably Robin has a better answer about this issue.

HTH.

Andrea.


Andrea Gavana (
gavana@kpo.kz)

Reservoir Engineer

KPDL

4, Millbank

SW1P 3JA London

Direct Tel: +44 (0) 20 717 08936

Mobile Tel: +44 (0) 77 487 70534

Fax: +44 (0) 20 717 08900

Web:
http://xoomer.virgilio.it/infinity77

¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯

Rama wrote:

If I run this script using python 2.4 on windows XP, I get an empty frame displayed maximized - as expected. However, if I convert this into an executable using this setup.py

from distutils.core import setup
import py2exe

setup(windows=["testframe.py"],)

then, the window which appears on running the executable is not maximized. It runs as if I have not specified the wx.MAXIMIZE flag at all?

Can someone please help me understand why?

Interestingly, if I run the script from ipython, it also does not show the window maximized.

IIRC, the way that wx.MAXIMIZE is used it is only a hint, and the hint can be overridden by Windows if there are other properties/settings that apply. For example, if the app is launched via a shortcut then the shortcut properties can be set to launch the app as normal, minimized or maximized and that will override whatever flags the app is using for its first top level window when it is shown.

···

--
Robin Dunn
Software Craftsman
http://wxPython.org Java give you jitters? Relax with wxPython!

IIRC, the way that wx.MAXIMIZE is used it is only a hint, and the hint
can be overridden by Windows if there are other properties/settings that

apply.

Ah,interesting.

For example, if the app is launched via a shortcut then the
shortcut properties can be set to launch the app as normal, minimized or

maximized and that will override whatever flags the app is using for its
first top level window when it is shown.

This however should not be the reason in this case since I am just double clicking on the executable created by py2exe. Does this executable have any inbuilt settings which may override the wx.MAXIMIZE settings? I shall look into this further.

thanks,

Rama

Hi,
I've found a strange behavior in method GetPosition() of wxWindow class ( and derived ).
On windows, if you create a window object

frame = wx.Frame(None, -1, "TESTING")

and you set the position to:
frame.SetPosition( (300, 45000) )

If you call method GetPosition, the result will be:
frame.GetPosition()
>>> (300, 32767)

32767 is the integer limit. Why GetPosition() returns this value??? and why on Unix Platform this problem was not found??

thx very much!

bye

Hello Mariano,

I've found a strange behavior in method GetPosition() of
wxWindow class ( and derived ).
On windows, if you create a window object

frame = wx.Frame(None, -1, "TESTING")

and you set the position to:
frame.SetPosition( (300, 45000) )

If you call method GetPosition, the result will be:
frame.GetPosition()
>>> (300, 32767)

No bugs here (AFAIK), the maximum limit on Windows in 32767. Whatever greater value you will give to SetPosition() will be truncated to 32767. I may be wrong here, but this is what I remember. Moreover, unless you are using a 15 meters Warner Bros Cinema wide screen, why in the world are you setting 45000 pixels for the y-position? Most of the PCs works at 1280x1024 or, on bigger screens, at 1600x1200 pixels in resolution. It's very uncommon to find higher resolution screens. In this case, where is the point in setting 45000 pixels for the frame position?

Andrea.

···

_________________________________________
Andrea Gavana (gavana@kpo.kz)
Reservoir Engineer
KPDL
4, Millbank
SW1P 3JA London

Direct Tel: +44 (0) 20 717 08936
Mobile Tel: +44 (0) 77 487 70534
Fax: +44 (0) 20 717 08900
Web: http://xoomer.virgilio.it/infinity77
¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯

Gavana, Andrea ha scritto:

Hello Mariano,

I've found a strange behavior in method GetPosition() of wxWindow class ( and derived ).
On windows, if you create a window object
frame = wx.Frame(None, -1, "TESTING")
and you set the position to:
frame.SetPosition( (300, 45000) )
If you call method GetPosition, the result will be:
frame.GetPosition()
>>> (300, 32767)

No bugs here (AFAIK), the maximum limit on Windows in 32767. Whatever greater value you will give to SetPosition() will be truncated to 32767. I may be wrong here, but this is what I remember. Moreover, unless you are using a 15 meters Warner Bros Cinema wide screen, why in the world are you setting 45000 pixels for the y-position? Most of the PCs works at 1280x1024 or, on bigger screens, at 1600x1200 pixels in resolution. It's very uncommon to find higher resolution screens. In this case, where is the point in setting 45000 pixels for the frame position?
Andrea.
_________________________________________
Andrea Gavana ()
Reservoir Engineer
KPDL
4, Millbank
SW1P 3JA London
Direct Tel: +44 (0) 20 717 08936
Mobile Tel: +44 (0) 77 487 70534
Fax: +44 (0) 20 717 08900
Web: ¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯
---------------------------------------------------------------------
To unsubscribe, e-mail: For additional commands, e-mail:

I must use positions over 32767 because I have an wxScrolledWindow,
which contains objects.

Each item has size: width=300, height=120.

If I insert in the scrolledWindow 300 elements, the OnPaint event will
draw only the first 273 objects, because the others 274 to 300 will be
designed in the same y position: 32767.

And it’s wrong.

I can insert in the wxScrolledWindow also 800 elements…

There is another way to do it? ( I don’t know… VirtualPosition??? )

thx

···

gavana@kpo.kzhttp://xoomer.virgilio.it/infinity77wxPython-users-unsubscribe@lists.wxwidgets.orgwxPython-users-help@lists.wxwidgets.org

//\ariano Di Felice

Java PHP Python Ruby programmer

with MySQL, PostgreSql, SQLite and Oracle support

Linux Platform Developer

Tel. 0735 703735
Cell +39 339 6407211

mariano.difelice@gmail.com

Mariano Di Felice wrote:

Gavana, Andrea ha scritto:

Hello Mariano,

I've found a strange behavior in method GetPosition() of wxWindow class ( and derived ).
On windows, if you create a window object
frame = wx.Frame(None, -1, "TESTING")
and you set the position to:
frame.SetPosition( (300, 45000) )
If you call method GetPosition, the result will be:
frame.GetPosition()
>>> (300, 32767)

No bugs here (AFAIK), the maximum limit on Windows in 32767. Whatever greater value you will give to SetPosition() will be truncated to 32767. I may be wrong here, but this is what I remember. Moreover, unless you are using a 15 meters Warner Bros Cinema wide screen, why in the world are you setting 45000 pixels for the y-position? Most of the PCs works at 1280x1024 or, on bigger screens, at 1600x1200 pixels in resolution. It's very uncommon to find higher resolution screens. In this case, where is the point in setting 45000 pixels for the frame position?
Andrea.

I must use positions over 32767 because I have an wxScrolledWindow,
which contains objects.

Each item has size: width=300, height=120.

If I insert in the scrolledWindow 300 elements, the OnPaint event will
draw only the first 273 objects, because the others 274 to 300 will be
designed in the same y position: 32767.

And it’s wrong.

I can insert in the wxScrolledWindow also 800 elements…

There is another way to do it? ( I don’t know… VirtualPosition??? )

Yow. This seems to me to be unreasonable – you’re essentially saying
“I can fit 4 people into my car, why can’t I fit 4000 people into it?”

You’re going to have to do the extra work to page the elements in and
out yourself, and you’ll probably have to handle the scroll bar
manually too. If I were doing this, I’d create a panel and a separate
scroll bar, stuff the objects into a collection, and draw them myself,
only drawing objects that actually intersect the visual area.

If these objects are actual controls that have something more than
click sensitivity, I’d suggest finding a different UI metaphor – this
one sounds painful to use. If you’re just scrolling things so people
can see them, maybe you can get away with a FloatCanvas and store
positions as floating point objects.

It’s nice to have powerful tools, but expecting them to be infinitely
powerful is asking too much, I think.

Kent Quirk ha scritto:

Mariano Di Felice wrote:

Gavana, Andrea ha scritto:

Hello Mariano,

I've found a strange behavior in method GetPosition() of wxWindow class ( and derived ).
On windows, if you create a window object
frame = wx.Frame(None, -1, "TESTING")
and you set the position to:
frame.SetPosition( (300, 45000) )
If you call method GetPosition, the result will be:
frame.GetPosition()
>>> (300, 32767)

No bugs here (AFAIK), the maximum limit on Windows in 32767. Whatever greater value you will give to SetPosition() will be truncated to 32767. I may be wrong here, but this is what I remember. Moreover, unless you are using a 15 meters Warner Bros Cinema wide screen, why in the world are you setting 45000 pixels for the y-position? Most of the PCs works at 1280x1024 or, on bigger screens, at 1600x1200 pixels in resolution. It's very uncommon to find higher resolution screens. In this case, where is the point in setting 45000 pixels for the frame position?
Andrea.

I must use positions over 32767 because I have an wxScrolledWindow,
which contains objects.

Each item has size: width=300, height=120.

If I insert in the scrolledWindow 300 elements, the OnPaint event will
draw only the first 273 objects, because the others 274 to 300 will be
designed in the same y position: 32767.

And it’s wrong.

I can insert in the wxScrolledWindow also 800 elements…

There is another way to do it? ( I don’t know… VirtualPosition??? )

Yow. This seems to me to be unreasonable – you’re essentially saying
“I can fit 4 people into my car, why can’t I fit 4000 people into it?”

You’re going to have to do the extra work to page the elements in and
out yourself, and you’ll probably have to handle the scroll bar
manually too. If I were doing this, I’d create a panel and a separate
scroll bar, stuff the objects into a collection, and draw them myself,
only drawing objects that actually intersect the visual area.

If these objects are actual controls that have something more than
click sensitivity, I’d suggest finding a different UI metaphor – this
one sounds painful to use. If you’re just scrolling things so people
can see them, maybe you can get away with a FloatCanvas and store
positions as floating point objects.

It’s nice to have powerful tools, but expecting them to be infinitely
powerful is asking too much, I think.


To unsubscribe, e-mail: For additional commands, e-mail:
Oh yes, I think that this is a good idea, but for my restricted
developer time, it’s impossible for me! :frowning:

The concept that I don’t understand is why for wxPython for Unix set
the position in log type, but in windows not.

I would like ovveride SetPosition and GetPosition method, but I’ve seen
that they are stored in a dll ( in unix in a .so file ), and for code
doesn’t work.

On Fedora Unix, this problem doesn’t exists, it works perfectly.

Ever Windows has problems!!! grunch!

bye

···

wxPython-users-unsubscribe@lists.wxwidgets.orgwxPython-users-help@lists.wxwidgets.org

//\ariano Di Felice

Java PHP Python Ruby programmer

with MySQL, PostgreSql, SQLite and Oracle support

Linux Platform Developer

Tel. 0735 703735
Cell +39 339 6407211

mariano.difelice@gmail.com

At the very least, it shouldn't take much development time to make n wxSplitterWindows (each with 200 panels) and place them in a wxNotebook to select which group of 200 is currently visible. That's probably one of the simpler methods of dealing with the problem.

I will echo the sentiments of others and say that whatever it is that you're doing, displaying this much information at once really doesn't sound like a good idea for users.

Tim

Mariano Di Felice wrote:

···

Oh yes, I think that this is a good idea, but for my restricted developer time, it's impossible for me! :frowning:
The concept that I don't understand is why for wxPython for Unix set the position in log type, but in windows not.
I would like ovveride SetPosition and GetPosition method, but I've seen that they are stored in a dll ( in unix in a .so file ), and for code doesn't work.

On Fedora Unix, this problem doesn't exists, it works perfectly.
Ever Windows has problems!!! grunch!

bye

--
/\/\ariano Di Felice
Java PHP Python Ruby programmer
with MySQL, PostgreSql, SQLite and Oracle support
Linux Platform Developer
mariano.difelice@gmail.com
Tel. 0735 703735
Cell +39 339 6407211
--------------------------------------------------------------------- To unsubscribe, e-mail: wxPython-users-unsubscribe@lists.wxwidgets.org For additional commands, e-mail: wxPython-users-help@lists.wxwidgets.org

Mariano Di Felice wrote:

32767 is the integer limit. Why GetPosition() returns this value??? and why on Unix Platform this problem was not found??

Because Windows grew up on a 16-bit toy operating system and so when somebody was designing the data structure that holds the screen size it was natural for them to use a 16-bit value for it because it saves a couple bytes and who would ever (in that engineer's lifetime anyway) have a screen with dimensions larger than 32k pixels? The X-Windows designers were more forward thinking (or more lazy depending on your point of view) and used 32-bit values for everything.

I must use positions over 32767 because I have an wxScrolledWindow, which contains <n> objects.
Each item has size: width=300, height=120.
If I insert in the scrolledWindow 300 elements, the OnPaint event will draw only the first 273 objects, because the others 274 to 300 will be designed in the same y position: 32767.
And it's wrong.

However there is a big difference between max screen size and max virtual size of a window. Unless you are still using a 16-bit version of Windows the scrollbars (and therefore wx.ScrolledWindow) will be able to handle size/positions > 32k with no problems. See the attached sample which both draws things on the DC and also positions child windows over a range of 100k.

bigscroll.py (876 Bytes)

···

--
Robin Dunn
Software Craftsman
http://wxPython.org Java give you jitters? Relax with wxPython!

Robin Dunn ha scritto:

Mariano Di Felice wrote:

32767 is the integer limit. Why GetPosition() returns this value??? and why on Unix Platform this problem was not found??

Because Windows grew up on a 16-bit toy operating system and so when somebody was designing the data structure that holds the screen size it was natural for them to use a 16-bit value for it because it saves a couple bytes and who would ever (in that engineer's lifetime anyway) have a screen with dimensions larger than 32k pixels? The X-Windows designers were more forward thinking (or more lazy depending on your point of view) and used 32-bit values for everything.

I must use positions over 32767 because I have an wxScrolledWindow, which contains <n> objects.
Each item has size: width=300, height=120.
If I insert in the scrolledWindow 300 elements, the OnPaint event will draw only the first 273 objects, because the others 274 to 300 will be designed in the same y position: 32767.
And it's wrong.

However there is a big difference between max screen size and max virtual size of a window. Unless you are still using a 16-bit version of Windows the scrollbars (and therefore wx.ScrolledWindow) will be able to handle size/positions > 32k with no problems. See the attached sample which both draws things on the DC and also positions child windows over a range of 100k.

------------------------------------------------------------------------

import wx
print wx.VERSION

class BigScrolledWindow(wx.ScrolledWindow):
    def __init__(self, parent):
        wx.ScrolledWindow.__init__(self, parent)
        self.Bind(wx.EVT_PAINT, self.OnPaint)

        self.SetVirtualSize((500, 100 * 1024))
        self.SetScrollRate(25,25)

        for y in xrange(250, self.GetVirtualSize().height, 500):
            pos = (25, y)
            pnl = wx.Panel(self, -1, pos, (150, 50), style=wx.SIMPLE_BORDER)
            wx.StaticText(pnl, -1, str(y), (5,5))
            assert pnl.GetPosition() == pos

    def OnPaint(self, evt):
        dc = wx.PaintDC(self)
        self.PrepareDC(dc)

        for y in xrange(0, self.GetVirtualSize().height, 500):
            dc.DrawText(str(y), 10, y)

app = wx.App(False)
frm = wx.Frame(None, title="big virtual size")
bsw = BigScrolledWindow(frm)
frm.Show()
app.MainLoop()

  ------------------------------------------------------------------------

---------------------------------------------------------------------
To unsubscribe, e-mail: wxPython-users-unsubscribe@lists.wxwidgets.org
For additional commands, e-mail: wxPython-users-help@lists.wxwidgets.org

Well, thx very much Robin! :smiley:
I've seen your example and works!!! HARRY UP!!
Now I adjust your code for my application, and I will write here the result!

bye

···

--
/\/\ariano Di Felice
Java PHP Python Ruby programmer
with MySQL, PostgreSql, SQLite and Oracle support
Linux Platform Developer
mariano.difelice@gmail.com
Tel. 0735 703735
Cell +39 339 6407211

Robin Dunn ha scritto:

Mariano Di Felice wrote:

32767 is the integer limit. Why GetPosition() returns this value??? and why on Unix Platform this problem was not found??

Because Windows grew up on a 16-bit toy operating system and so when somebody was designing the data structure that holds the screen size it was natural for them to use a 16-bit value for it because it saves a couple bytes and who would ever (in that engineer's lifetime anyway) have a screen with dimensions larger than 32k pixels? The X-Windows designers were more forward thinking (or more lazy depending on your point of view) and used 32-bit values for everything.

I must use positions over 32767 because I have an wxScrolledWindow, which contains <n> objects.
Each item has size: width=300, height=120.
If I insert in the scrolledWindow 300 elements, the OnPaint event will draw only the first 273 objects, because the others 274 to 300 will be designed in the same y position: 32767.
And it's wrong.

However there is a big difference between max screen size and max virtual size of a window. Unless you are still using a 16-bit version of Windows the scrollbars (and therefore wx.ScrolledWindow) will be able to handle size/positions > 32k with no problems. See the attached sample which both draws things on the DC and also positions child windows over a range of 100k.

------------------------------------------------------------------------

import wx
print wx.VERSION

class BigScrolledWindow(wx.ScrolledWindow):
    def __init__(self, parent):
        wx.ScrolledWindow.__init__(self, parent)
        self.Bind(wx.EVT_PAINT, self.OnPaint)

        self.SetVirtualSize((500, 100 * 1024))
        self.SetScrollRate(25,25)

        for y in xrange(250, self.GetVirtualSize().height, 500):
            pos = (25, y)
            pnl = wx.Panel(self, -1, pos, (150, 50), style=wx.SIMPLE_BORDER)
            wx.StaticText(pnl, -1, str(y), (5,5))
            assert pnl.GetPosition() == pos

    def OnPaint(self, evt):
        dc = wx.PaintDC(self)
        self.PrepareDC(dc)

        for y in xrange(0, self.GetVirtualSize().height, 500):
            dc.DrawText(str(y), 10, y)

app = wx.App(False)
frm = wx.Frame(None, title="big virtual size")
bsw = BigScrolledWindow(frm)
frm.Show()
app.MainLoop()

  ------------------------------------------------------------------------

---------------------------------------------------------------------
To unsubscribe, e-mail: wxPython-users-unsubscribe@lists.wxwidgets.org
For additional commands, e-mail: wxPython-users-help@lists.wxwidgets.org

Hi,
    The size problem was solved ( it's seems ), but now the OnPaint Event don't work well: only some elements are visualized.
If I comment the code SetVirtualSize(), the wxPaintDC draw well, but only until 32767 y.

···

--
/\/\ariano Di Felice
Java PHP Python Ruby programmer
with MySQL, PostgreSql, SQLite and Oracle support
Linux Platform Developer
mariano.difelice@gmail.com
Tel. 0735 703735
Cell +39 339 6407211

Robin Dunn ha scritto:

Mariano Di Felice wrote:

32767 is the integer limit. Why GetPosition() returns this value??? and why on Unix Platform this problem was not found??

Because Windows grew up on a 16-bit toy operating system and so when somebody was designing the data structure that holds the screen size it was natural for them to use a 16-bit value for it because it saves a couple bytes and who would ever (in that engineer's lifetime anyway) have a screen with dimensions larger than 32k pixels? The X-Windows designers were more forward thinking (or more lazy depending on your point of view) and used 32-bit values for everything.

I must use positions over 32767 because I have an wxScrolledWindow, which contains <n> objects.
Each item has size: width=300, height=120.
If I insert in the scrolledWindow 300 elements, the OnPaint event will draw only the first 273 objects, because the others 274 to 300 will be designed in the same y position: 32767.
And it's wrong.

However there is a big difference between max screen size and max virtual size of a window. Unless you are still using a 16-bit version of Windows the scrollbars (and therefore wx.ScrolledWindow) will be able to handle size/positions > 32k with no problems. See the attached sample which both draws things on the DC and also positions child windows over a range of 100k.

------------------------------------------------------------------------

import wx
print wx.VERSION

class BigScrolledWindow(wx.ScrolledWindow):
    def __init__(self, parent):
        wx.ScrolledWindow.__init__(self, parent)
        self.Bind(wx.EVT_PAINT, self.OnPaint)

        self.SetVirtualSize((500, 100 * 1024))
        self.SetScrollRate(25,25)

        for y in xrange(250, self.GetVirtualSize().height, 500):
            pos = (25, y)
            pnl = wx.Panel(self, -1, pos, (150, 50), style=wx.SIMPLE_BORDER)
            wx.StaticText(pnl, -1, str(y), (5,5))
            assert pnl.GetPosition() == pos

    def OnPaint(self, evt):
        dc = wx.PaintDC(self)
        self.PrepareDC(dc)

        for y in xrange(0, self.GetVirtualSize().height, 500):
            dc.DrawText(str(y), 10, y)

app = wx.App(False)
frm = wx.Frame(None, title="big virtual size")
bsw = BigScrolledWindow(frm)
frm.Show()
app.MainLoop()

  ------------------------------------------------------------------------

---------------------------------------------------------------------
To unsubscribe, e-mail: wxPython-users-unsubscribe@lists.wxwidgets.org
For additional commands, e-mail: wxPython-users-help@lists.wxwidgets.org

Ah! I have forgotten that the wxPaintDC problem that doesn't work with SetVirtualSize(), it doesn't works on Windows.
But on Unix it's all OK!

BOH!

bye

···

--
/\/\ariano Di Felice
Java PHP Python Ruby programmer
with MySQL, PostgreSql, SQLite and Oracle support
Linux Platform Developer
mariano.difelice@gmail.com
Tel. 0735 703735
Cell +39 339 6407211

Robin Dunn ha scritto:

Mariano Di Felice wrote:

32767 is the integer limit. Why GetPosition() returns this value??? and why on Unix Platform this problem was not found??

Because Windows grew up on a 16-bit toy operating system and so when somebody was designing the data structure that holds the screen size it was natural for them to use a 16-bit value for it because it saves a couple bytes and who would ever (in that engineer's lifetime anyway) have a screen with dimensions larger than 32k pixels? The X-Windows designers were more forward thinking (or more lazy depending on your point of view) and used 32-bit values for everything.

I must use positions over 32767 because I have an wxScrolledWindow, which contains <n> objects.
Each item has size: width=300, height=120.
If I insert in the scrolledWindow 300 elements, the OnPaint event will draw only the first 273 objects, because the others 274 to 300 will be designed in the same y position: 32767.
And it's wrong.

However there is a big difference between max screen size and max virtual size of a window. Unless you are still using a 16-bit version of Windows the scrollbars (and therefore wx.ScrolledWindow) will be able to handle size/positions > 32k with no problems. See the attached sample which both draws things on the DC and also positions child windows over a range of 100k.

------------------------------------------------------------------------

import wx
print wx.VERSION

class BigScrolledWindow(wx.ScrolledWindow):
    def __init__(self, parent):
        wx.ScrolledWindow.__init__(self, parent)
        self.Bind(wx.EVT_PAINT, self.OnPaint)

        self.SetVirtualSize((500, 100 * 1024))
        self.SetScrollRate(25,25)

        for y in xrange(250, self.GetVirtualSize().height, 500):
            pos = (25, y)
            pnl = wx.Panel(self, -1, pos, (150, 50), style=wx.SIMPLE_BORDER)
            wx.StaticText(pnl, -1, str(y), (5,5))
            assert pnl.GetPosition() == pos

    def OnPaint(self, evt):
        dc = wx.PaintDC(self)
        self.PrepareDC(dc)

        for y in xrange(0, self.GetVirtualSize().height, 500):
            dc.DrawText(str(y), 10, y)

app = wx.App(False)
frm = wx.Frame(None, title="big virtual size")
bsw = BigScrolledWindow(frm)
frm.Show()
app.MainLoop()

  ------------------------------------------------------------------------

---------------------------------------------------------------------
To unsubscribe, e-mail: wxPython-users-unsubscribe@lists.wxwidgets.org
For additional commands, e-mail: wxPython-users-help@lists.wxwidgets.org

NADA guys!
It doesn't works!
If I add 300 Items, it will display only 273 items.... :frowning:
It don't works!!! NOOOOOOO

Another question: it's possible with wx.PaintDC draw an existing object already designed with wxPaintDC???

bye

···

--
/\/\ariano Di Felice
Java PHP Python Ruby programmer
with MySQL, PostgreSql, SQLite and Oracle support
Linux Platform Developer
mariano.difelice@gmail.com
Tel. 0735 703735
Cell +39 339 6407211

Mariano Di Felice wrote:

Ah! I have forgotten that the wxPaintDC problem that doesn't work with SetVirtualSize(), it doesn't works on Windows.
But on Unix it's all OK!

It works on XP for me. Which version of Windows are you using? Which version of wxPython? Does my sample app work for you or not? (The last panel displayed is at position 102250.) If it does work then you are doing something wrong in your app.

···

--
Robin Dunn
Software Craftsman
http://wxPython.org Java give you jitters? Relax with wxPython!

Mariano Di Felice wrote:

[BTW, there is no reason to quote the entire message you are replying to when only a small part of it will give context to your message.]

NADA guys!
It doesn't works!
If I add 300 Items, it will display only 273 items.... :frowning:
It don't works!!! NOOOOOOO

Is your virtual size large enough to show all 300 items?

Another question: it's possible with wx.PaintDC draw an existing object already designed with wxPaintDC???

If your "existing object" is designed to be able to draw itself on any DC then yes. If it expects to be drawn on its own window then probably not.

···

--
Robin Dunn
Software Craftsman
http://wxPython.org Java give you jitters? Relax with wxPython!

Robin Dunn ha scritto:

Mariano Di Felice wrote:

Ah! I have forgotten that the wxPaintDC problem that doesn't work with SetVirtualSize(), it doesn't works on Windows.
But on Unix it's all OK!

It works on XP for me. Which version of Windows are you using? Which version of wxPython? Does my sample app work for you or not? (The last panel displayed is at position 102250.) If it does work then you are doing something wrong in your app.

Yes, your example work very well.
I use Windows XP, wxPython 2.6.1.0 unicode and Python 2.3.5

···

--
/\/\ariano Di Felice
Java PHP Python Ruby programmer
with MySQL, PostgreSql, SQLite and Oracle support
Linux Platform Developer
mariano.difelice@gmail.com
Tel. 0735 703735
Cell +39 339 6407211
---------------------------------------------------------
NO ai brevetti software! http://www.nosoftwarepatents.com
---------------------------------------------------------
Nota di riservatezza:
Il presente messaggio, corredato dei relativi allegati contiene informazioni da considerarsi strettamente riservate, ed è destinato esclusivamente al destinatario sopra indicato, il quale è l'unico autorizzato ad usarlo, copiarlo e, sotto la propria responsabilità, diffonderlo. Chiunque ricevesse questo messaggio per errore o comunque lo leggesse senza esserne legittimato è avvertito che trattenerlo, copiarlo, divulgarlo, distribuirlo a persone diverse dal destinatario è severamente proibito, ed è pregato di rinviarlo immediatamente al mittente distruggendo l'originale.

Confidentiality Notice:
This message, together with its annexes, contains information to be deemed strictly confidential and is destined only to the addressee(s) identified above who only may use, copy and, under his/their responsibility, further disseminate it. If anyone received this message by mistake or reads it without entitlement is forewarned that keeping, copying, disseminating or distributing this message to persons other than the addressee(s) is strictly forbidden and is asked to transmit it immediately to the sender and to erase the original message received.
--------------------------------------------------------------------------

Robin Dunn ha scritto:

Mariano Di Felice wrote:

[BTW, there is no reason to quote the entire message you are replying to when only a small part of it will give context to your message.]

NADA guys!
It doesn't works!
If I add 300 Items, it will display only 273 items.... :frowning:
It don't works!!! NOOOOOOO

Is your virtual size large enough to show all 300 items?

Yes. I ve set virtual size to 650, 120(item's height) * 500(number of items)

···

Another question: it's possible with wx.PaintDC draw an existing object already designed with wxPaintDC???

--
/\/\ariano Di Felice
Java PHP Python Ruby programmer
with MySQL, PostgreSql, SQLite and Oracle support
Linux Platform Developer
mariano.difelice@gmail.com
Tel. 0735 703735
Cell +39 339 6407211