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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T23:43:45+00:00 2026-06-15T23:43:45+00:00

My python application launches a subprocess that creates a pyglet window. When the pyglet

  • 0

My python application launches a subprocess that creates a pyglet window. When the pyglet window opens, it is in front of all other windows, and takes keyboard focus. I’d like my pyglet window to open in the background, and not take focus. Is this possible?

Stripped-down version of the code I’m using:

import pyglet

pyglet.window.Window()
pyglet.app.run() 

I’m using Windows 7, in case that makes a difference..

  • 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-15T23:43:46+00:00Added an answer on June 15, 2026 at 11:43 pm

    Reversing focus is OS specific:

    pyglet does not provide OS specific window control. So most likely you will have to use an ad-hoc trick for quick&dirty solutions or try to approach it with extensions like pywin32 using Windows API and/or COM to list through the stack of taskbar applications to reverse stealing of focus. You can also try to create your own window (container – which you can manipulate) first – in order to delegate its context to pyglet.

    Delaying stealing of focus

    On the other hand if according to your program logic you just want to delay actual showing of you application you can play with visibility:

    import pyglet
    
    w = pyglet.window.Window()
    w.set_visible(False)
    pyglet.app.run() 
    

    So if you don’t want to play with delegation of window context, you can probably do the following:

    1. start your application w/o showing the window
    2. find the focus of the current active window by getting its handle/id
    3. show your window
    4. give back the focus to the previous window

    The above assumes working with windows API. I think MSDN had examples on focus changing.. If you know PID of your current window (main application) this should simplify the step 2.

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

Sidebar

Related Questions

I'm writing a python application that has a glade gui. Using subprocess to execute
I have inherited a windows Python application that communicates with linux RabbitMQ. I need
I have python application that shoud be launched as windows executable. I'm using py2exe
I'm writing a Python application that takes a command as an argument, for example:
I have a Python application in the bottle web-server that accesses a C shared-object
I'm building a Python application that utilizes a bunch of translated strings. The directory
I have a small GTK python application that imports a package (Twisted) that may
I am trying to build a Python application that connects to Oracle database and
When my python application starts, I would like to load all of the data
I am writing a Python application that queries social media APIs via cURL. Most

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.