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

  • Home
  • SEARCH
  • 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 7652051
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 31, 20262026-05-31T11:39:54+00:00 2026-05-31T11:39:54+00:00

I have ran into a problem that i suspect has to do painting/drawing elements

  • 0

I have ran into a problem that i suspect has to do painting/drawing elements in cairo.

I have a borderless window in pygtk, but i draw two rectangles with cairo.a black rectangle, and a grey rectangle inside. When the window is resized, there seems to be parts of the inner rectangle doesn’t get drawn/painted. I have included 3 screenshots to show this issue.

enter image description here
enter image description here
enter image description here

As you can see in the second and third picture, some pieces of the window do not get painted grey. One way to fix this, is to call pygtk’s window’s present() method..but this makes my program extrmely slow, as the height of the window changes with pretty much each keystroke. So i was wondering what alternatives i have to fix this.

below is the relevant cairo code i use

def expose(self, widget, e):
    cr = widget.window.cairo_create()

    # Draw the background
    cr.set_operator(cairo.OPERATOR_SOURCE)

    # Create black rectangle with 60% opacity (serves as border)
    (width, height) = widget.get_size()
    cr.set_source_rgba(0, 0, 0, 0.6)
    cr.rectangle(0, 0, width, height)
    cr.fill()

    # Inside the black rectangle, put a lighter one (will hold widgets)
    (width, height) = widget.get_size()
    cr.set_source_rgb(205/255, 205/255, 193/255)
    cr.rectangle(10, 10, width-20, height-20)
    cr.fill()   

    return False

def screen_changed(self, widget, old_screen = None):
    screen = widget.get_screen()
    colormap = screen.get_rgba_colormap()
    widget.set_colormap(colormap)
  • 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-31T11:39:56+00:00Added an answer on May 31, 2026 at 11:39 am

    It’s basically a GTK+ bug, I believe. When a window is resized, GTK+ doesn’t always queue the entire window for repainting. As a workaround, you can call window.queue_draw() at the place where you cause the window to be resized.

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

Sidebar

Related Questions

Today I ran into the following problem with NUnit. I have a class, that
I have recently ran into a problem that would not allow me to use
Currently developing a PHP framework and have ran into my first problem. I need
Never ran into this problem with jQuery before. I have the following: $(document).ready(function() {
Here's a problem I ran into recently. I have attributes strings of the form
I've been working on optimizing a query and have ran into a situation that's
I ran into an interesting dilemma today. I have a function that handles information
I'm currently messing around in FORTRAN 77 and I've ran into a problem that
I recently started programming my first Cocoa app. I have ran into a problem
I ran into a problem that occurs when using the module PanedWindow Tix. Let's

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.