Hum .. First a quick hello from France (It's my first post :).
I have a small question. I have to build some toolbar. So I lanch my
gimp .. draw some _nice_ icons .. and save all this in a big xpm
file. Now I want to build buttons from this xpm. but I can't find the
way to build a button from a piece of the xpm . (I usually do that in
C/Gtk .. and a bit new to wx_pyton)
Is that clear ? (My english is a bit awfull .. you know )
Thanks
Bye Bye Jérôme
···
--
---------------------------------------------------------------------
LinuX Tricks & Tips by SoiF http://www.linux-france.org/article/ltt/
Mp3 Server BoX (Mp3SB) http://www.mp3sb.org/
---------------------------------------------------------------------
I think wxBitmapButton is what you want.
I generally run the wxPythonDemo (a symbolic link to
.../python1.5/site-packages/wxPython/demo/demo.py) and look at the
controls there. Click on controls and then wxButton and it will give a
demonstration of common buttons and also the sample code.
Brendan Simon.
SoiF at Home wrote:
···
Hum .. First a quick hello from France (It's my first post :).
I have a small question. I have to build some toolbar. So I lanch my
gimp .. draw some _nice_ icons .. and save all this in a big xpm
file. Now I want to build buttons from this xpm. but I can't find the
way to build a button from a piece of the xpm . (I usually do that in
C/Gtk .. and a bit new to wx_pyton)
Is that clear ? (My english is a bit awfull .. you know )
Thanks
Bye Bye Jérôme
--
---------------------------------------------------------------------
LinuX Tricks & Tips by SoiF http://www.linux-france.org/article/ltt/
Mp3 Server BoX (Mp3SB) http://www.mp3sb.org/
---------------------------------------------------------------------
I have a small question. I have to build some toolbar. So I lanch my
gimp .. draw some _nice_ icons .. and save all this in a big xpm
file. Now I want to build buttons from this xpm. but I can't find the
way to build a button from a piece of the xpm . (I usually do that in
C/Gtk .. and a bit new to wx_pyton)
Nomally separate image files would be used, but I think it is possible to do
what you want. You can load your big XMP into a wxImage, and use
image.GetSubImage to extract part of it, and then convert to a wxBitmap with
subimage.ConvertToBitmap.
Thanks .. that what I'm looking for :))
but I have a small pb
img = wxImage('stock.xpm',wxBITMAP_TYPE_XPM)
return me a error saying that xpm isn't supported (I try w/ other
format png ) ("No image handler for type 9 defined") .
but it work in the demo code
So I use this :
xpm = wxBitmap('stock.xpm', wxBITMAP_TYPE_XPM)
img = wxImageFromBitmap(xpm)
while i<7 :
temp = img.GetSub.....
....
That works but it's a bit awfull
A ++ Jérôme
···
On Mon, Sep 11, 2000 at 07:02:41PM -0700, Robin Dunn wrote:
I have a small question. I have to build some toolbar. So I lanch my
gimp .. draw some _nice_ icons .. and save all this in a big xpm
file. Now I want to build buttons from this xpm. but I can't find the
way to build a button from a piece of the xpm . (I usually do that in
C/Gtk .. and a bit new to wx_pyton)
Nomally separate image files would be used, but I think it is possible to do
what you want. You can load your big XMP into a wxImage, and use
image.GetSubImage to extract part of it, and then convert to a wxBitmap with
subimage.ConvertToBitmap.
--
---------------------------------------------------------------------
LinuX Tricks & Tips by SoiF http://www.linux-france.org/article/ltt/
Mp3 Server BoX (Mp3SB) http://www.mp3sb.org/
[Portishead] - [Toy Box] [01:37/05:43] [ 28%] [100]
---------------------------------------------------------------------
Thanks .. that what I'm looking for :))
but I have a small pb
img = wxImage('stock.xpm',wxBITMAP_TYPE_XPM)
return me a error saying that xpm isn't supported
I'm not sure why there is not an image handler for XPM. I suppose they
thought that XMPs would only be used for bitmaps.
(I try w/ other
format png ) ("No image handler for type 9 defined") .
You can get around this by calling wxInitAllImageHandlers() during program
initialization.
Hum .. it doesn't change anything ..
img = wxImage('stock.xpm',wxBITMAP_TYPE_XPM)
always give me the same result .
"No image handler for type XX defined" even when I use a jpeg / png
.. or what you want .. I really can't find why .. or even call the
InitAllImageHandlers()
I just noticed that wxBitmap has GetSubBitmap() so you can do the same thing
without having to convert to and from wxImage.
And I don't get this on my wxPython package ..
···
On Tue, Sep 12, 2000 at 04:03:48PM -0700, Robin Dunn wrote:
---------------------------------------------------------------------
dpkg -l | grep wxWin
ii python-wxwin 2.1.11-2 Python binding for wxWindows, a cross-platform C++ toolkit
ii wxgtk2.1 2.1.11-2 wxWindows Cross-platform C++ GUI toolkit (GTK+ runtime)