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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 7, 20262026-06-07T06:56:39+00:00 2026-06-07T06:56:39+00:00

Ok, I realize that’s not a very clear title, so hopefully this can clarify

  • 0

Ok, I realize that’s not a very clear title, so hopefully this can clarify it a bit better (and if anybody can come up with a clearer name for it, I’d appreciate the help!).

I am creating a points tracker for my kindergarten class. What I see in my mind is a bar with a 0 at the bottom and a 100 at the top, and a color gradient points bar that scans up and down from 0 to 100. When they hit the touch screen, the bar freezes and their team gets x points, where x is the number the bar freezes on.

Right now, I’m just working on the function which moves the bar (haven’t even got the freezing/interrupting put in yet). I’ve put this together, but it feels really inelegant and ugly.

def score_inc():
    x = 0
    while x < 100:
        x += 1
        time.sleep(0.01)
    while x > 100:
        x -= 1
        time.sleep(0.01)

Not to mention, I’m reasonably confident this code would block operation, meaning I couldn’t display/update the graphics.

This is my first foray into GUI programming, so I’m taking it cautiously and trying to write a GUI-less backend before I write the graphical frontend, is that the wrong route? Is there a smoother, less ugly way to implement something like this using a function which is ‘GUI aware’, for lack of a better term?

  • 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-06-07T06:56:40+00:00Added an answer on June 7, 2026 at 6:56 am

    In wxPython, you’d probably want to use a wx.Slider, although I don’t think it supports the colors you’re looking for. However, you might be able to tie the slider events to a wx.GCDC or wx.PaintDC that can do it for you. I’d ask on the wxPython user’s group for other suggestions.

    You are right about time.sleep() blocking the GUI’s mainloop. Your GUI would not respond if you did it that way. Instead, you should use a wx.Timer. Here’s a tutorial on that. You could put the time.sleep() into a thread, but I think that’s overkill and will make it needlessly complicated.

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

Sidebar

Related Questions

I realize that you can't 100% know that this will work in all browsers.
I realize that this is a question that will probably not have a single
I realize that this can be a matter of preference, but I have noticed
I realize that this question might not make sense to some, but I was
I realize that this question is not unlike asking someone for the name of
I realize that this is probably a very basic question, but I have spent
I realize that virtual template functions are not allowed in c++. Because of my
I realize that a SO user has formerly asked this question but it was
I realize that TWTweetComposeViewController is new to iOS 5 (which is now a bit
I realize that the answer to this question is likely quite obvious (if somewhat

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.