Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6760887
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T14:07:05+00:00 2026-05-26T14:07:05+00:00

I am trying to make a windows canvas type rectangle, here is an image

  • 0

I am trying to make a windows canvas type rectangle, here is an image if you are having issues understanding what i mean,

a busy cat

Is there any way todo this in wxpython? ( also, is there a way to set it to automatically adjust to the window width -20px?, so a radius around the window, and will adjust to the users window size.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-26T14:07:06+00:00Added an answer on May 26, 2026 at 2:07 pm

    EDIT: I asked on the wxPython IRC channel and a fellow named “r4z” came up with the following edit to my code which worked for me on Windows 7.

    import wx
    
    ########################################################################
    class MyPanel(wx.Panel):
        """"""
    
        #----------------------------------------------------------------------
        def __init__(self, parent):
            """Constructor"""
            wx.Panel.__init__(self, parent)
            self.Bind(wx.EVT_PAINT, self.OnPaint)
    
        #----------------------------------------------------------------------
        def OnPaint(self, event):
            """"""
            pdc = wx.PaintDC(self)
            try:
                dc = wx.GCDC(pdc)
            except:
                dc = pdc
    
            w, h = self.GetSizeTuple()
            w = w - 10
            h = h - 10
    
            dc.Clear()
            dc.DrawRectangle(x=5, y=5, width=w, height=h)
    
    
    #----------------------------------------------------------------------
    def OnSize(event):
        event.EventObject.Refresh()
        event.Skip()
    
    
    if __name__ == "__main__":
        app = wx.App(False)
        frame = wx.Frame(None, title="Test")
        panel = MyPanel(frame)
        frame.Bind(wx.EVT_SIZE, OnSize)
        frame.Show()
        app.MainLoop()
    

    Alternately, you might look at the wx.StaticBox widget.

    EDIT #2: You could also just set the frame’s style like this and skip the whole OnSize business:

    frame = wx.Frame(None, title="Test", style=wx.DEFAULT_FRAME_STYLE|wx.FULL_REPAINT_ON_RESIZE)
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

this is my first post here! I'm trying to make a windows forms program
I'm trying to make a Windows Explorer-like in CSS and for now here is
I'm trying to make a simple Windows Phone 7 Silverlight app. There's the MainPage.xaml
I am trying to make a Windows Phone App. I could not find any
I am trying to make a visible image array in C# for windows phone
I'm trying to make an image zoomable in my windows phone 7 application. (code
I'm trying to make my app a good Windows citizen, so I use matching
i am trying to make a setup of windows service.but when i was building
I'm trying to make 'dark' area when my modal window is opened. Here is
I am trying to make a contribution to the windows task bar so when

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.