ttkbootstrap kütüphanesini kullandığımda unsupported locale setting hatasıyla karşılaşıyorum. Kod içerisinde herhangi bir Türkçe karakter bulunmuyor. Tam hata çıktısı şu şekilde:
Traceback (most recent call last):
File "c:\Users\Okan\Desktop\Python\Projects\Training\tkinter_01.py", line 3, in <module>
import ttkbootstrap as ttk
File "C:\Users\Okan\AppData\Roaming\Python\Python312\site-packages\ttkbootstrap\__init__.py", line 3, in <module>
from ttkbootstrap.widgets import *
File "C:\Users\Okan\AppData\Roaming\Python\Python312\site-packages\ttkbootstrap\widgets.py", line 14, in <module>
from ttkbootstrap.dialogs import Querybox
File "C:\Users\Okan\AppData\Roaming\Python\Python312\site-packages\ttkbootstrap\dialogs\__init__.py", line 1, in <module>
from ttkbootstrap.dialogs.dialogs import *
File "C:\Users\Okan\AppData\Roaming\Python\Python312\site-packages\ttkbootstrap\dialogs\dialogs.py", line 536, in <module>
class DatePickerDialog:
File "C:\Users\Okan\AppData\Roaming\Python\Python312\site-packages\ttkbootstrap\dialogs\dialogs.py", line 566, in DatePickerDialog
locale.setlocale(locale.LC_ALL, locale.setlocale(locale.LC_TIME, ""))
File "C:\Program Files\Python312\Lib\locale.py", line 615, in setlocale
return _setlocale(category, locale)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^
locale.Error: unsupported locale setting
Baya araştırmasını yaptım ancak çözüme ulaşamadım. Yardımcı olabilir misiniz?
import tkinter as tk
#from tkinter import ttk
import ttkbootstrap as ttk
import locale
locale.setlocale(locale.LC_ALL, 'Turkish_Turkey.1254')
Ancak aynı hatayı verdi:
Traceback (most recent call last):
File "c:\Users\Okan\Desktop\Python\Projects\Training\tkinter_03.py", line 3, in <module>
import ttkbootstrap as ttk
File "C:\Users\Okan\AppData\Roaming\Python\Python312\site-packages\ttkbootstrap\__init__.py", line 3, in <module>
from ttkbootstrap.widgets import *
File "C:\Users\Okan\AppData\Roaming\Python\Python312\site-packages\ttkbootstrap\widgets.py", line 14, in <module>
from ttkbootstrap.dialogs import Querybox
File "C:\Users\Okan\AppData\Roaming\Python\Python312\site-packages\ttkbootstrap\dialogs\__init__.py", line 1, in <module>
from ttkbootstrap.dialogs.dialogs import *
File "C:\Users\Okan\AppData\Roaming\Python\Python312\site-packages\ttkbootstrap\dialogs\dialogs.py", line 536, in <module>
class DatePickerDialog:
File "C:\Users\Okan\AppData\Roaming\Python\Python312\site-packages\ttkbootstrap\dialogs\dialogs.py", line 566, in DatePickerDialog
locale.setlocale(locale.LC_ALL, locale.setlocale(locale.LC_TIME, ""))
File "C:\Program Files\Python312\Lib\locale.py", line 615, in setlocale
return _setlocale(category, locale)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^
locale.Error: unsupported locale setting
import locale
try:
# Mevcut yerel ayarları kontrol et
print("Varsayılan Yerel Ayar:", locale.getdefaultlocale())
# Yerel ayarı en geniş uyumluluğa sahip olacak şekilde ayarla
locale.setlocale(locale.LC_ALL, 'en_US.UTF-8') # 'tr_TR.UTF-8' da denenebilir
print("Yeni Yerel Ayar:", locale.getlocale())
except locale.Error as e:
print(f"Yerel ayar ayarlanamadı: {e}")