I want to display images, typically 800x600 pixels. In the docs for wx.StaticBitmap it says “under Windows 9x the size of bitmap is limited to 64x64 pixels.” I need this to work on Windows 7, 8, and 10. Is wx.StaticBitmap the right choice, or is there another widget I ought to use? Or do I need to create a custom widget and paint the image myself?
wx.Image
Johnf
···
On 4/18/19 2:22 AM, Mark wrote:
I want to display images, typically 800x600 pixels.
In the docs for wx.StaticBitmap it says “under Windows 9x the
size of bitmap is limited to 64x64 pixels.” I need this to work
on Windows 7, 8, and 10. Is wx.StaticBitmap the right choice, or
is there another widget I ought to use? Or do I need to create a
custom widget and paint the image myself?
–
You received this message because you are subscribed to the Google
Groups “wxPython-users” group.
To unsubscribe from this group and stop receiving emails from it,
send an email to wxpython-users+unsubscribe@googlegroups.com.
For more options, visit [https://groups.google.com/d/optout](https://groups.google.com/d/optout).
wx.Image isn’t a widget (doesn’t derive from wx.Window or wx.Control) so while it can hold an image it can’t show one in the GUI – or can it?
···
On Thursday, April 18, 2019 at 2:25:18 PM UTC+1, johnf wrote:
wx.Image
Johnf
On 4/18/19 2:22 AM, Mark wrote:
I want to display images, typically 800x600 pixels.
In the docs for wx.StaticBitmap it says “under Windows 9x the
size of bitmap is limited to 64x64 pixels.” I need this to work
on Windows 7, 8, and 10. Is wx.StaticBitmap the right choice, or
is there another widget I ought to use? Or do I need to create a
custom widget and paint the image myself?
–
You received this message because you are subscribed to the Google
Groups “wxPython-users” group.
To unsubscribe from this group and stop receiving emails from it,
send an email to wxpytho...@googlegroups.com.
For more options, visit [https://groups.google.com/d/optout](https://groups.google.com/d/optout).
This class encapsulates
a platform-independent image.
An image can be created
from data, or using wx.Bitmap.ConvertToImage
.
An image can be loaded from a file in a variety of formats, and is
extensible to new formats via image format handlers. Functions are
available to set and get image bits, so it can be used for basic
image manipulation.
A wx.Image cannot
(currently) be drawn directly to a wx.DC .
Instead, a platform-specific wx.Bitmap object
must be created from it using the Bitmap.Bitmap(wxImage,int depth)
constructor. This bitmap can then be drawn in a device context,
using wx.DC.DrawBitmap
.
More on the difference
between wx.Image and wx.Bitmap: wx.Image is
just a buffer of RGB
bytes with an
optional buffer for the alpha bytes. It is all generic, platform
independent and image file format independent code. It includes
generic code for scaling, resizing, clipping, and other
manipulations of the image data. OTOH, wx.Bitmap is
intended to be a wrapper of whatever is the native image format
that is quickest/easiest to draw to a DC or to be the target of
the drawing operations performed on a wx.MemoryDC .
By splitting the responsibilities between Image/wxBitmap like this
then it’s easier to use generic code shared by all platforms and
image types for generic operations and platform specific code
where performance or compatibility is needed.
One colour value of the
image may be used as a mask colour which will lead to the
automatic creation of a wx.Mask object
associated to the bitmap object.
png = wx.Image(imageFile, wx.BITMAP_TYPE_ANY).ConvertToBitmap()
wx.StaticBitmap(self, -1, png, (10, 5), (png.GetWidth(), png.GetHeight()))
···
On 4/18/19 7:07 AM, Mark wrote:
wx.Image isn't a widget (doesn't derive from
wx.Window or wx.Control) so while it can hold an image it can’t
show one in the GUI – or can it?On Thursday, April 18, 2019 at 2:25:18 PM UTC+1, johnf wrote:
wx.Image
Johnf
On 4/18/19 2:22 AM, Mark wrote:
I want to display images, typically 800x600
pixels. In the docs for wx.StaticBitmap it says “under
Windows 9x the size of bitmap is limited to 64x64
pixels.” I need this to work on Windows 7, 8, and 10. Is
wx.StaticBitmap the right choice, or is there another
widget I ought to use? Or do I need to create a custom
widget and paint the image myself?
–
You received this message because you are subscribed to
the Google Groups “wxPython-users” group.
To unsubscribe from this group and stop receiving emails
from it, send an email to wxpytho...@googlegroups.com.
For more options, visit [https://groups.google.com/d/optout](https://groups.google.com/d/optout).
–
You received this message because you are subscribed to the Google
Groups “wxPython-users” group.
To unsubscribe from this group and stop receiving emails from it,
send an email to wxpython-users+unsubscribe@googlegroups.com.
For more options, visit [https://groups.google.com/d/optout](https://groups.google.com/d/optout).
I think we’re at cross-purposes.
I know how to use wx.Image and wx.StaticBitmap. But the docs for wx.StaticBitmap warn that on Windows 9x there’s a 64x64 size limit so I wanted to know (1) if that is true on Windows 7, 8, and 10, and (2) if it is true, how I should display larger images in the GUI.
I use it on Windows
(7 and 10) and Linux (GTK). Have you tried it and show code
where it does not work?
Johnf
···
On 4/18/19 7:15 AM, Mark wrote:
I think we’re at cross-purposes.
I know how to use wx.Image and wx.StaticBitmap. But the
docs for wx.StaticBitmap warn that on Windows 9x there’s a
64x64 size limit so I wanted to know (1) if that is true on
Windows 7, 8, and 10, and (2) if it is true, how I should
display larger images in the GUI.
–
You received this message because you are subscribed to the Google
Groups “wxPython-users” group.
To unsubscribe from this group and stop receiving emails from it,
send an email to wxpython-users+unsubscribe@googlegroups.com.
For more options, visit [https://groups.google.com/d/optout](https://groups.google.com/d/optout).
StaticBitmap should be fine, Windows has evolved a lot since 1998 and is no longer nearly as constrained as it was back then. There is also a generic widget in wx.lib.statbmp if the native widget does give you trouble. The other option would be to draw it yourself in an EVT_PAINT handler instead of using a dedicated widget.
···
On Thursday, April 18, 2019 at 7:15:24 AM UTC-7, Mark wrote:
I think we’re at cross-purposes.
I know how to use wx.Image and wx.StaticBitmap. But the docs for wx.StaticBitmap warn that on Windows 9x there’s a 64x64 size limit so I wanted to know (1) if that is true on Windows 7, 8, and 10, and (2) if it is true, how I should display larger images in the GUI.
–
Robin
Mark wrote:
I want to display images, typically 800x600 pixels. In the docs for wx.StaticBitmap it says "under Windows 9x the size of bitmap is limited to 64x64 pixels." I need this to work on Windows 7, 8, and 10. Is wx.StaticBitmap the right choice, or is there another widget I ought to use? Or do I need to create a custom widget and paint the image myself?
Has the history of Windows really been lost? Windows 9x refers to Windows 95, 98 and ME. These were the 16-bit systems derived directly from the original Windows 3.0 kernel. The last release in this line was in 2000. All Windows systems in the 21st Century derive from the Windows NT kernel, which was 32-bit from the start, and does not have the same memory limitations.
You should silently ignore any references to Windows 9x, and it would probably be good for the community to yank antiquated references from the documents.
···
--
Tim Roberts, timr@probo.com
Providenza & Boekelheide, Inc.
Thanks. Maybe the docs could drop the size limit sentence or at least say it doesn’t apply to modern Windows (7, 8, 10)?
···
On Thursday, 18 April 2019 16:56:00 UTC+1, Robin Dunn wrote:
On Thursday, April 18, 2019 at 7:15:24 AM UTC-7, Mark wrote:
I think we’re at cross-purposes.
I know how to use wx.Image and wx.StaticBitmap. But the docs for wx.StaticBitmap warn that on Windows 9x there’s a 64x64 size limit so I wanted to know (1) if that is true on Windows 7, 8, and 10, and (2) if it is true, how I should display larger images in the GUI.
StaticBitmap should be fine, Windows has evolved a lot since 1998 and is no longer nearly as constrained as it was back then. There is also a generic widget in wx.lib.statbmp if the native widget does give you trouble. The other option would be to draw it yourself in an EVT_PAINT handler instead of using a dedicated widget.
–
Robin
It looks like that one, at least, has already been removed from the docs in the wxWidgets master branch.
···
On Thursday, April 18, 2019 at 9:36:23 AM UTC-7, Tim Roberts wrote:
and it would
probably be good for the community to yank antiquated references from
the documents.
–
Robin