Giter Club home page Giter Club logo

Comments (9)

ProsperousHeart avatar ProsperousHeart commented on August 27, 2024 5

This is still an issue. Windows 10, python 3.10

from easygui.

blipk avatar blipk commented on August 27, 2024 1

This is still happening on windows 10.

A hackish workaround if anyone happens to be looking for this:

import ctypes
import win32gui
import win32con
from pywinauto.findwindows    import find_window

def show_window(title):
    if os.name != 'nt': return
    time.sleep(0.25)
    window = None
    done = False
    attempts = 0
    print("Searching for window with title:", title)
    while not done:
        attempts += 1
        if attempts > 50: break
        try:
            window = find_window(best_match=title)
        except:
            window = None
            continue
        if window:
            print("Found window", window)
            try:
                win32gui.SetWindowPos(window, win32con.HWND_TOPMOST, 0, 0, 0, 0, win32con.SWP_SHOWWINDOW | win32con.SWP_NOMOVE | win32con.SWP_NOREPOSITION | win32con.SWP_NOSIZE)
                win32gui.SetForegroundWindow(window)
                done = True
                print("Window set to foreground")
                return True
            except Exception as e:
                print("Error bringing window to front", e)
                continue
    print("Search done with no result....")
    return False
t = threading.Thread(target=show_window,name='WindowFocus',args=['Select a video'])
t.daemon = True
t.start()
chosen = easygui.fileopenbox(default=target+'\\*.webm', title="Select a video", filetypes=[['*.mp4', '*.webm', 'Videos']])

from easygui.

JuliaScythe avatar JuliaScythe commented on August 27, 2024

Hmm. As a temporary fix you could have a message in the console (or some prominent place in your GUI if you have one) saying a file box has opened... But my windows 10 box could not replicate it...

from easygui.

LiaungYip avatar LiaungYip commented on August 27, 2024

@Mrnumbers9 ; Yes, it's an intermittent issue. For me, it went away after playing with some things and rebooting.

I was also in email correspondence with a person named Stav Bar-Sheshet who was also having the same issue; and another anonymous poster on Stack Overflow, also having the issue.

from easygui.

JuliaScythe avatar JuliaScythe commented on August 27, 2024

Good

from easygui.

brombeerberg avatar brombeerberg commented on August 27, 2024

I am still struggling with the same problem of easygui-dialogs opening in the background using Anaconda with Spyder on Windows 7 (32-bit). In my Programme, I first open a fileopenbox which is always in the background whereas the subsequent multenterbox is always in the foreground. Of course I would like to have the fileopenbox already in the foreground. As long as there is no keyword argument for the desired behaviour within easygui, one workaround could be to apply a raise_window-function as proposed on http://physicalmodelingwithpython.blogspot.de/2015/07/raising-figure-window-to-foreground.html . But what is the figure name of the easygui-dialog that I have to pass to this function?

from easygui.

godfoder avatar godfoder commented on August 27, 2024

I have this problem in my application as well: https://github.com/idigbio/idigbio-media-appliance . In my case this is behavior is complicated by the fact that the dialog is spawned by a call to an internal web-service (the UI is an HTML based, not TK). The good news here is that diropenbox always spawns behind the browser window when called, so at least its reproducible. Filesavebox seems to always be in front of the browser though, so its not consistent across box types.

Perhaps adding something like this:
http://stackoverflow.com/questions/1892339/how-to-make-a-window-jump-to-the-front

to the root window before spawning the dialog would work?

from easygui.

blipk avatar blipk commented on August 27, 2024

@godfoder can we add this fix to fileopenbox as well?
Or perhaps theres a way to expose the localRoot so it can be done by the user?

from easygui.

LiaungYip avatar LiaungYip commented on August 27, 2024

See also #163 .

from easygui.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.