How to custom Control's appearance

Hi, Che

Got the attachment.
You are the one (to me). Thank you.

But it seems that we have a new situation here: when running this demo program and resizing the frame, you’ ll find the image border doesn’t flush itself, so I suppose we need to code a Update method, isn’t it?

Sorry, I am a wxPython newbie too. I just don’t know how this layout works, or further more, I just don’t know how all these Windows’ get painted and displayed in the screen and how to make them related to events to do whatever you want (I know how to code a method related to your event).

Thanks again!

Hi, Che

Got the attachment.
You are the one (to me). Thank you.

You're very welcome.

But it seems that we have a new situation here: when running this demo
program and resizing the frame, you' ll find the image border doesn't flush
itself, so I suppose we need to code a Update method, isn't it?

Sorry, my mistake. One way to do this easily is just change

a) the size of the image to be larger. So change line 40 to be
    size=wx.Size(24, 1000)

b) turn off the flag wx.GROW. So change the end of line 15 to be
    flag=0)

I include the corrected code as text at the bottom of this email, with
some other changes (see next paragraph).

Sorry, I am a wxPython newbie too. I just don't know how this layout works,
or further more, I just don't know how all these Windows' get painted and
displayed in the screen and how to make them related to events to do
whatever you want (I know how to code a method related to your event).

This takes awhile to understand. Take your time, read the http://wxpython.org/
site (and tutorial materials there), get the wxPython book, play with the demo,
ask questions to this list after trying things out and getting stuck, Google for
answers, watch ShowMeDo.com videos, etc.

I've redone the example to make it even simpler to show that this is really
just a box next to a picture of a blue border--that's it! In my
previous example
I used sizers, which is a little difficult to start with if you are new, but you
should learn about them after you get used to the basics.

Good luck, and corrected sample follows below, with a few comments
to show the few working parts of this simple construction.

Che

···

On Sun, Nov 16, 2008 at 9:17 PM, Roy Liu <jingeelio@gmail.com> wrote:

#--------------------------------------------------------------------------

import wx

#Just creates the Frame1
def create(parent):
    return Frame1(parent)

#This is the frame, the container for everything inside it, a panel
and an image.
class Frame1(wx.Frame):
    def _init_ctrls(self, prnt):
        wx.Frame.__init__(self, id=-1, name='', parent=prnt,
              pos=wx.Point(216, 119), size=wx.Size(402, 489),
              style=wx.DEFAULT_FRAME_STYLE, title='Frame1')
        self.SetClientSize(wx.Size(394, 455))

        #This is a panel--the grey part.
        self.panel1 = wx.Panel(id=-1, name='panel1', parent=self,
              pos=wx.Point(0, 0), size=wx.Size(394, 455),
              style=wx.TAB_TRAVERSAL)

        #This is a static bitmap. It's just an image, and its height is 1000.
        self.staticBitmap1 = wx.StaticBitmap(bitmap=wx.Bitmap(u'C:/Documents and
              Settings/cmyme/Desktop/image_as_border.jpg',
              wx.BITMAP_TYPE_JPEG), id=-1,
              name='staticBitmap1', parent=self.panel1, pos=wx.Point(0, -8),
              size=wx.Size(24, 1000), style=0)

    #Just tells the above things to run.
    def __init__(self, parent):
        self._init_ctrls(parent)

#Runs the whole frame above and displays it.
if __name__ == '__main__':
    app = wx.PySimpleApp()
    frame = create(None)
    frame.Show()

    app.MainLoop()

Hi, Che

Got it. Thank you. It’s really cool.