Custom Frame Issues

34 views
Skip to first unread message

Mike Stover

unread,
Apr 16, 2015, 1:39:54 PM4/16/15
to wxpytho...@googlegroups.com
Hello All,

I'm hoping someone here will be able to help me a little. 

I am using the code, which is attached with minor changes, from HERE as a template for a small program. With the minor changes I can run the original code and see the desired results for the frame, however, if I add anything such as a panel that uses the full frame I lose the border drawn around the frame.

I am open to suggestions of possible solutions as I would like to use the FlatMenuBar and a status bar with this as well.

Thanks,
Mike S
fancy_frame.py
my_frame.py

Michael Moriarity

unread,
Apr 17, 2015, 11:48:38 AM4/17/15
to wxpytho...@googlegroups.com
I can only guess what you tried, but it should be clear that if you add a panel to the frame and allow it to fill the whole area, it will cover over the transparent corners. I would try making my panel smaller than the frame, using a sizer and a flag=wx.ALL and border=8 or whatever width is needed to keep the panel from overlapping the transparent corners.

--
Best Regards,
Michael Moriarity

Mike Stover

unread,
Apr 17, 2015, 11:54:48 AM4/17/15
to wxpytho...@googlegroups.com
I apologize, I should have included the fact I had attempted to use sizers to keep the panel away from the corners. Using a sizer results in the frame corners appearing normally, however I am still not getting the desired appearance. I will keep trying different combinations and see how things work out.

Thanks,
Mike S

C M

unread,
Apr 17, 2015, 12:52:27 PM4/17/15
to wxpytho...@googlegroups.com
This is an untested total shot in the dark, but what about trying something like:

dc = wx.PaintDC(self.my_panel)

such that you are painting the rounded rectangle border on the panel rather than on the frame?

Che


--
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-user...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Mike Stover

unread,
Apr 17, 2015, 5:00:48 PM4/17/15
to wxpytho...@googlegroups.com
Hi Che,

I just tried that, and ended up with just a corner of the program visible. At first I thought nothing was showing, but then I discovered the faint curved line of the top left corner. This may have been a result of not using a sizer.

Modifying the OnPaint a bit I was able to partially achieve what I am working towards. I have attached the example code.
main_frame.py

Mike Stover

unread,
Apr 22, 2015, 8:57:06 AM4/22/15
to wxpytho...@googlegroups.com
After a bit more digging I discovered that only Frames can have rounded corners. While I am confident this can be worked around I am setting this particular part of my project aside. Thank you all for the help and suggestions! 
Reply all
Reply to author
Forward
0 new messages