#πŸ”’ Resizing terminal window

14 messages Β· Page 1 of 1 (latest)

naive cave
#
def loadUp():
    os.system('cls')
    os.system('mode con: cols=75 lines=40')  
    hwnd = ctypes.windll.kernel32.GetConsoleWindow()
    if hwnd:
        user32 = ctypes.windll.user32
        screen_width = user32.GetSystemMetrics(0)
        screen_height = user32.GetSystemMetrics(1)
        width = 600
        height = 600
        x = int((screen_width - width) / 2)
        y = int((screen_height - height) / 2)
        ctypes.windll.user32.MoveWindow(hwnd, x, y, width, height, True)
    print("\n" * 18 + " " * 30 + Fore.GREEN + "Loaded" + Style.RESET_ALL)
    input("\n\n" + " " * 25 + "Press Enter to continue...")

loadUp()```

why does this not resize the window?
runic fossilBOT
#

@naive cave

Python help channel opened

Remember to:

  • Ask your Python question, not if you can ask or if there's an expert who can help.
  • Show a code sample as text (rather than a screenshot) and the error message, if you've got one.
  • Explain what you expect to happen and what actually happens.

:warning: Do not pip install anything that isn't related to your question, especially if asked to over DMs.

plucky wyvern
#

you dont do anything if hwnd is false-y

#

you never raise an error

#

or log a message

naive cave
#

it found hwnd

#

but its because the cmd was never made to run as admin so i changed it and working

plucky wyvern
#

!close to close the post

naive cave
#

!close

runic fossilBOT
#
Python help channel closed with !close

This help channel has been closed. Feel free to create a new post in #1035199133436354600. To maximize your chances of getting a response, check out this guide on asking good questions.