Hide / show windows taskbar?

I have googled and youtubed bur not finding what I was looking for.
I want to make a script that hides/ show the taskbar in windows.
Any ideas where to start?

Using python 3.9 and pycharm.

Cheers
Goesta

Hiding and showing the Windows taskbar can be done using ctypes to call the Windows functions FindWindowA (FindWindowA function (winuser.h) - Win32 apps | Microsoft Docs) and ShowWindow (ShowWindow function (winuser.h) - Win32 apps | Microsoft Docs).

from ctypes import windll

# get the handle to the taskbar
h = windll.user32.FindWindowA(b'Shell_TrayWnd', None)

# hide the taskbar
windll.user32.ShowWindow(h, 0)

# show the taskbar again
windll.user32.ShowWindow(h, 9)

Thanx a lot. I will try it tonight :blush:

Aohan , This worked . But I have 2 monitors . Monitor 1 via hdmi, and that works with your script.
Monitor 2 via USB and Displaylink , and there nothing happens.
Any ideas?

Goesta

When there are multiple monitors, the second taskbar window has a different name. Based on what I’m reading at remove_task_bar not working with multi_monitor · Issue #85 · TimUntersberger/nog · GitHub, the second taskbar window gets named 'Shell_SecondTrayWnd'. Check whether the following works for the second monitor.

from ctypes import windll

# get the handle to the taskbar
h = windll.user32.FindWindowA(b'Shell_SecondTrayWnd', None)

# hide the taskbar
windll.user32.ShowWindow(h, 0)

# show the taskbar again
windll.user32.ShowWindow(h, 9)

It was a small typo:_ Shell_SecondaryTrayWnd…But now it works!!
Many thanks for your help ::grinning_face_with_smiling_eyes: