<span class="gmail_quote">On 6/26/05, <b class="gmail_sendername">Adam Cripps</b> <<a href="mailto:kabads@gmail.com" target="_blank" onclick="return top.js.OpenExtLink(window,event,this)">kabads@gmail.com</a>> wrote:
</span>
<blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
On 6/25/05, Adam Bark <<a href="mailto:adam.jtm30@gmail.com" target="_blank" onclick="return top.js.OpenExtLink(window,event,this)">adam.jtm30@gmail.com</a>> wrote:<br>> Thanks for the info Adam I just seem to be having a problem with the panel
<br>> size it greys out nearly all the image. Ideally I would like to make the
<br>> panel transparent but I can't work out how to do that.<br>><br>><br>> On 6/25/05, Adam Cripps <<a href="mailto:kabads@gmail.com" target="_blank" onclick="return top.js.OpenExtLink(window,event,this)">
kabads@gmail.com</a>> wrote:<br>> > On 6/25/05, Adam Bark <
<a href="mailto:adam.jtm30@gmail.com" target="_blank" onclick="return top.js.OpenExtLink(window,event,this)">adam.jtm30@gmail.com</a> > wrote:<br>> > > Is it possible to put controls into a shaped window in wxPython. I have
<br>> > > tried putting a button on the demo and it becomes the exact size and
<br>> shape<br>> > > of the window. Also when I tried to bind it to an action it wouldn't<br>> even<br>> > > start.<br>> > ><br>> > > Adam<br>> > ><br>> ><br>> > I'm working through something similar myself at the moment.
<br>> ><br>> > Try adding a wx.Panel to the frame and then the button to the panel.<br>> > You can position them through pos parameter, but it should default to<br>> > the top left of the panel and have a good size if you use
<br>> > button.SetSize(button.GetBestSize())<br>> ><br>> > HTH<br>> ><br>> > Adam<br><br>Adam - how much code do you have? Why not post it either here or the<br>wxpython-users list (to which I'm also subscribed) and we can take a
<br>look.<br><br>Adam<br><br>--<br><a href="http://www.monkeez.org/" target="_blank" onclick="return top.js.OpenExtLink(window,event,this)">http://www.monkeez.org</a><br>PGP key: 0x7111B833</blockquote>
<br>
I tried posting to the wxpython-users list but I'm not sure it worked nobody replied anyway.<br>
Here's my test script:<br>
<br>
import wx<br>
<br>
class Frame(wx.Frame):<br>
def __init__(self):<br>
wx.Frame.__init__(self, None, -1, "Shaped Window",<br>
style =<br>
wx.FRAME_SHAPED<br>
| wx.SIMPLE_BORDER<br>
| wx.FRAME_NO_TASKBAR<br>
| wx.STAY_ON_TOP<br>
)<br>
self.hasShape = False<br>
self.delta = (0,0)<br>
<br>
self.Bind(wx.EVT_PAINT, self.OnPaint)<br>
self.Bind(wx.EVT_MOTION, self.OnMouseMove)<br>
<br>
self.bkground = wx.Bitmap("/home/adam/bkgrnd.gif", wx.BITMAP_TYPE_GIF)<br>
w, h = self.bkground.GetWidth(), self.bkground.GetHeight()<br>
self.SetClientSize((w, h))<br>
self.Bind(wx.EVT_WINDOW_CREATE, self.SetWindowShape)<br>
panel = Panel(self, w, h)<br>
panel.Show()<br>
dc = wx.ClientDC(self)<br>
dc.DrawBitmap(self.bkground, 0,0, True)<br>
<br>
def SetWindowShape(self, evt):<br>
# Use the bitmap's mask to determine the region<br>
r = wx.RegionFromBitmap(self.bkground)<br>
self.hasShape = self.SetShape(r)<br>
<br>
def OnPaint(self, event):<br>
dc = wx.PaintDC(self)<br>
dc.DrawBitmap(self.bkground, 0,0, True)<br>
<br>
def OnMouseMove(self, evt):<br>
if evt.Dragging() and evt.LeftIsDown():<br>
x, y = self.ClientToScreen(evt.GetPosition())<br>
fp = (x - self.delta[0], y - self.delta[1])<br>
self.Move(fp)<br>
<br>
class Panel(wx.Panel):<br>
def __init__(self, parent, width, height):<br>
wx.Panel.__init__(self, parent, -1, size=(width, height))<br>
<br>
button = wx.Button(self, -1, "hello")<br>
button.SetSize(button.GetBestSize())<br>
self.SetSize((width, height))<br>
#print dir(self)<br>
<br>
if __name__ == "__main__":<br>
app = wx.PySimpleApp()<br>
frame = Frame()<br>
frame.Show()<br>
app.MainLoop()<br>
<br>
Thanks.<br><span class="sg">
Adam.</span>