Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Querybox.get_color Not Work #561

Open
EVA-JianJun opened this issue Apr 10, 2024 · 0 comments
Open

Querybox.get_color Not Work #561

EVA-JianJun opened this issue Apr 10, 2024 · 0 comments
Labels
bug Something isn't working

Comments

@EVA-JianJun
Copy link

EVA-JianJun commented Apr 10, 2024

Desktop (please complete the following information):

ttkbootstrap Version: 1.10.1
OS: Windows
language: zh_ch

Describe the bug

获取颜色无法正常获取

from ttkbootstrap.dialogs import Querybox

color = Querybox().get_color()

print(color) # GET None
print(type(color))

这是由于在 ttkbootstrap\dialogs\colorchooser.py 中只判断了等于 'OK', 但是在中文环境下按钮会返回 '确定'

def on_button_press(self, button):
    if button.cget('text') == 'OK': # <<<<<<<< this
        values = self.colorchooser.get_variables()
        self._result = ColorChoice(
            rgb=(values.r, values.g, values.b), 
            hsl=(values.h, values.s, values.l), 
            hex=values.hex
        )
        self._toplevel.destroy()            
    self._toplevel.destroy()   

只需要修改这个判断程序就能正常工作, 下面这样的修改是正确的吗?

# change it
if button.cget('text') == 'OK':
if button.cget('text') == MessageCatalog.translate('OK'):
@EVA-JianJun EVA-JianJun added the bug Something isn't working label Apr 10, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant