В эти последние дни я немного изучил Tkinter, и первое, что я хочу сделать перед тем, как создать «платье» для своего программного обеспечения CLI, - это адаптировать стиль виджетов Tkinter по умолчанию к моей операционной системе (Windows 10).
В первый раз я подумал: «Хорошо, может быть, я сам смогу создать стиль, а затем использовать его в функции», но он кажется сложнее, чем кажется.
Я хотел бы сделать что-то вроде этого (давайте начнем с основного окна и стиля кнопок):
def Style(TkObject):
if the operating system is W10: <----- How can I do it?
if TkObject is the main window: <----- How can I do it?
window.configure(background="#f0f0f0")
if TkObject is a button: <----- How can I do it?
button.configure(activebackground="#ececec")
button.configure(activeforeground="#000000")
button.configure(background="#e1e1e1")
button.configure(borderwidth="1", relief="solid")
button.configure(disabledforeground="#a3a3a3")
button.configure(foreground="#000000")
button.configure(highlightbackground="#d9d9d9")
button.configure(highlightcolor="black")
button.configure(pady="0")
..
.. <----- the button syle is not finished yet
if the operating system is windows W7 or Vista:
.. # it's the same code for W10 but with the appropriate style
if the operating system is windows WXP:
.. # it's the same code for W10 but with the appropriate style
if the operating system is Ubuntu Gnome:
.. # it's the same code for W10 but with the appropriate style
Можете ли вы помочь мне с моим кодом? Есть ли способ автоматически адаптировать стиль? наверное кто-то уже это сделал ..