I'd like to create a simple shaped window in wxPython. More or less I want to do the wx equivalent to Tkinter's self.overrideredirect(1) (It get's rid of the default OS boarder), then round the corners on the window.
相关问题
- how to define constructor for Python's new Nam
- streaming md5sum of contents of a large remote tar
- How to get the background from multiple images by
- Evil ctypes hack in python
- Correctly parse PDF paragraphs with Python
There's a shaped frame demo in the wxPython demos. I apologize for the indirect source. They originally came as a windows installer here:
source code
You'll want to look at shaped_frame_mobile.py or shaped_frame.py, which both call images.py from that listing for the sample window bitmap. It's not the exact equivalent to
overrideredirect
since you will have to provide an image to be drawn for the frame, but it could still help you accomplish something similar.The important parts are the functions that set the window shape based on the bitmap and handle the wx.EVT_PAINT event:
Edit - Here's an altered
shaped_frame_mobile.py
that loads the .png image specified in the IMAGE_PATH variable. Change that to point to your image: