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 649763
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 13, 20262026-05-13T21:58:46+00:00 2026-05-13T21:58:46+00:00

The simple curve in this application only appears when it’s dragged off the screen,

  • 0

The simple curve in this application only appears when it’s dragged off the screen, or the window is resized. When the application just starts up it doesn’t appear, and when the window is maximized or minimized it also disappears. However, all of these times, “Path Drawn” is printed, so all of the painting functions are called. Is there something I’m doing wrong with regards to creating and drawing on the graphicscontext? If not, how can I make the window totally refresh in these special cases?

import wx

class Path(object):
    def paint(self,gc):
        print "Path Drawn"
        gc.SetPen(wx.Pen("#000000",1))
        path=gc.CreatePath()
        path.MoveToPoint(wx.Point2D(10,10))
        path.AddCurveToPoint(wx.Point2D(10,50),
                             wx.Point2D(10,150),
                             wx.Point2D(100,100))
        gc.DrawPath(path)


class TestPane(wx.Panel):
    def __init__(self,parent=None,id=-1):
        wx.Panel.__init__(self,parent,id,style=wx.TAB_TRAVERSAL)
        self.SetBackgroundColour("#FFFFFF")
        self.Bind(wx.EVT_PAINT,self.onPaint)
        self.SetDoubleBuffered(True)
        self.path=Path()

    def onPaint(self, event):
        event.Skip()

        dc=wx.PaintDC(self)
        dc.BeginDrawing()
        gc = wx.GraphicsContext.Create(dc)

        gc.PushState()
        self.path.paint(gc)
        gc.PopState()
        dc.EndDrawing()

    def drawTestRects(self,dc):
        dc.SetBrush(wx.Brush("#000000",style=wx.SOLID))
        dc.DrawRectangle(50,50,50,50)
        dc.DrawRectangle(100,100,100,100)

class TestFrame(wx.Frame):
    def __init__(self, parent, title):
        wx.Frame.__init__(self, parent, title=title, size=(640,480))
        self.mainPanel=TestPane(self,-1)

        self.Show(True)


app = wx.App(False)
frame = TestFrame(None,"Test App")
app.MainLoop()
  • 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-13T21:58:46+00:00Added an answer on May 13, 2026 at 9:58 pm

    Comment out the self.SetDoubleBuffered(True) part and it will work, because due to bug http://trac.wxwidgets.org/ticket/11138 window isn’t refreshed correctly if SetDoubleBuffered and GraphicsContext are used together.

    If you MUST need double buffering implement it yourselves e.g. first draw to a MeomryDC and then blit or paint bitmap to paint dc.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Simple ASP.NET application. I have two drop-down controls. On the first-drop down I have
Simple as the title states: Can you use only Java commands to take a
Simple question, hopefully an easy way and just want to verify I'm doing it
Simple question, but one that I've been curious about...is there a functional difference between
Simple question, how do you list the primary key of a table with T-SQL?
Simple question - I've got a bucketload of cruddy html pages to clean up
Simple question that keeps bugging me. Should I HTML encode user input right away
Simple question: Can a swing frame be completely modal ( block all others windows
Simple yes or no question, and I'm 90% sure that it is no... but
Simple question, spurred on by the removal of the target attribute in HTML 4.0

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.