Zingzy/hPyT

The library used in the program

Closed this issue ยท 9 comments

Hello, thank you for this library.
I wanted to know with which gui library the hPyt Preview App v1.2.0 was written in Python?
Was it with customTkinter?

Hey, thanks a lot for the support... Yes, the hPyt Preview App was written in Python using the customTkinter library ๐Ÿ˜ƒ

@Zingzy
Thank you for your reply.
May I ask how you created this theme? I mean the glass mode like Windows 11 in the program... Thank you.
Screenshot (393)

The glass mode on windows 11 is called Mica and I used this library to do so ๐Ÿ˜ƒ

@Zingzy
Thank you for the tutorial.
I went to study the documentation of this library and whatever I did, I was unsuccessful and faced the error:
ImportError: cannot import name 'MicaTheme' from 'win32mica'
How did you use it?
my code:

from hPyT import *
from customtkinter import * # you can use any other library from the above mentioned list
from win32mica import ApplyMica, MicaTheme, MicaStyle

window = CTk() # creating a window using CustomTkinter
window.title("Talayar")
window.geometry('1280x720')
set_appearance_mode('dark')

mode = MicaTheme.DARK  # Dark mode mica effect
mode = MicaTheme.LIGHT # Light mode mica effect
mode = MicaTheme.AUTO  # Apply system theme, and change it if system theme changes
style = MicaStyle.DEFAULT # Default backdrop effect
style = MicaStyle.ALT     # Alt backdrop effect

def callbackFunction(NewTheme):
    if NewTheme == MicaTheme.DARK:
        print("Theme has changed to dark!")
    else:
        print("Theme has changed to light!")

hwnd = window.winId().__int__()

ApplyMica(HWND=hwnd, Theme=mode, Style=style, OnThemeChange=callbackFunction)

window_frame.center(window)
window.mainloop()

I hope you will always be like this: ๐Ÿ˜ƒ

@Nigacatch Thats a wierd error, perhaps you are using an older version of win32mica

Upgrade win32mica to the latest version:

pip install --upgrade win32mica

There were some problem in the script too, here is the fixed script:

from hPyT import *
from customtkinter import * # you can use any other library from the above mentioned list
from win32mica import ApplyMica, MicaTheme, MicaStyle

window = CTk() # creating a window using CustomTkinter
window.title("Talayar")
window.configure(fg_color="black")
window.geometry('1280x720')
set_appearance_mode('dark')

mode = MicaTheme.AUTO  # Apply system theme, and change it if system theme changes
style = MicaStyle.ALT     # MIcaAlt backdrop effect

def callbackFunction(NewTheme):
    if NewTheme == MicaTheme.DARK:
        print("Theme has changed to dark!")
    else:
        print("Theme has changed to light!")

hwnd = window.frame()    # window.winId().__int__() does not work for tkinter

ApplyMica(HWND=hwnd, Theme=mode, Style=style, OnThemeChange=callbackFunction)

window_frame.center(window)
window.mainloop()

image

@Zingzy
Thank you for your help and guidance.
With your help, the appearance of my program has become much more beautiful:

pic

thank you again... so ๐Ÿ˜ƒ

WOW looks amazing ๐Ÿ˜
You should also make the background of the window have transparent MicaALT like the title bar by setting the background color to black

@Zingzy
I did, but this color looks better, thank you very much.

Ok, no problem ๐Ÿ‘