rdbende / Sun-Valley-ttk-theme

A gorgeous theme for Tkinter/ttk, based on the Sun Valley visual style ✨
https://pypi.org/project/sv-ttk
MIT License
1.97k stars 112 forks source link

Can I use this use with PySimpleGUI? #10

Closed iniwap closed 2 years ago

iniwap commented 2 years ago

Can this use with PySimpleGUI?

rdbende commented 2 years ago

I've never tried PySimpleGUI but I think it's not possible. Since PSG uses legacy tk widgets, not ttk (themed tk) widgets it's not possible to apply a ttk theme, and you can only use psg's color schemes.

Fancy2209 commented 10 months ago

I've never tried PySimpleGUI but I think it's not possible. Since PSG uses legacy tk widgets, not ttk (themed tk) widgets it's not possible to apply a ttk theme, and you can only use psg's color schemes.

you can use TTK!

import PySimpleGUI as sg
import sv_ttk
layout = [[sg.T('Fun with TTK Scrollbars')],
          [sg.Multiline('\n'.join([str(x) for x in range(50)]), size=(40,20), expand_x=True, expand_y=True),
           sg.Listbox(list(range(40)), s=(10,15),
                     sbar_background_color='green', sbar_trough_color='red', sbar_relief='ridge', sbar_arrow_color='purple', sbar_frame_color='yellow',)],
          [sg.Button('Exit'), sg.Sizegrip()]]

window = sg.Window('TTK Scrollbars 1', layout, resizable=True, ttk_theme='winnative', use_ttk_buttons=True)

while True:
    event, values = window.read()
    print(event, values)
    if event == sg.WIN_CLOSED or event == 'Exit':
        break

window.close()

# Our second window uses both set_options and the Window object to change the scrollbars

sg.set_options(sbar_width=30, sbar_arrow_width=30)

layout = [[sg.T('Fun with TTK Scrollbars 2')],
          [sg.Multiline('\n'.join([str(x) for x in range(50)]), size=(40,20), expand_x=True, expand_y=True),
           sg.Listbox(list(range(40)), s=(10,15),
                     sbar_background_color='green', sbar_trough_color='red',  sbar_arrow_color='purple', sbar_frame_color='yellow',)],
          [sg.Button('Exit'), sg.Sizegrip()]]

window = sg.Window('TTK Scrollbars 2', layout, sbar_relief=sg.RELIEF_SOLID, resizable=True)

while True:
    event, values = window.read()
    print(event, values)
    if event == sg.WIN_CLOSED or event == 'Exit':
        break

window.close()