Skip to content

Commit

Permalink
fixed front() function logic
Browse files Browse the repository at this point in the history
  • Loading branch information
ngdplnk committed Apr 9, 2024
1 parent 1436f2a commit 8edc1e2
Showing 1 changed file with 5 additions and 13 deletions.
18 changes: 5 additions & 13 deletions 2-development/dev.py
Original file line number Diff line number Diff line change
Expand Up @@ -115,30 +115,22 @@
def limpiar_consola():
if os.name == 'nt': # En Windows - On Windows
os.system('cls')
else: # En sistemas Unix-like - On Unix-like systems
else: # For Linux
os.system('clear')

# WINDOW TITLE
def window_title(title):
if sys.platform.startswith('win32'): # En Windows - On Windows
ctypes.windll.kernel32.SetConsoleTitleW(title)
elif sys.platform.startswith('linux') or sys.platform.startswith('darwin'): # En sistemas Unix-like - On Unix-like systems
elif sys.platform.startswith('linux') or sys.platform.startswith('darwin'): # For Linux
sys.stdout.write(f"\x1b]2;{title}\x07")

# BRING WINDOW TO FRONT
def front():
if os.name == 'nt': # For Windows
# Get the handle of the console window
h_wnd = ctypes.windll.kernel32.GetConsoleWindow()

# Bring the console window to the foreground
ctypes.windll.user32.SetForegroundWindow(h_wnd)
else: # For Linux/OS X
# Get the PID of the current process
pid = os.getpid()

# Use wmctrl to bring the window with the given PID to the front
subprocess.call(['wmctrl', '-ia', str(pid)])
os.system("echo off && echo ShowConsole && echo on")
else: # For Linux
os.system("wmctrl -a 'Terminal'")

# ENGLISH
def eng():
Expand Down

0 comments on commit 8edc1e2

Please sign in to comment.