TkinterEP / ttkthemes

A group of themes for the ttk extenstions for Tkinter
GNU General Public License v3.0
364 stars 47 forks source link

ImportError: cannot import name 'ThemedStyle' from partially initialized module 'ttkthemes' (most likely due to a circular import) #75

Closed Raj-Kumar-Mishra closed 3 years ago

Raj-Kumar-Mishra commented 4 years ago

hello, my code is-

from tkinter import *
from ttkthemes import ThemedStyle
import tkinter.ttk as ttk
root = Tk()
style = ThemedStyle()
style.set_theme("plastik")
root.mainloop()

issue- ImportError: cannot import name 'ThemedStyle' from partially initialized module 'ttkthemes' (most likely due to a circular import) (C:\Users\mishra\ttkthemes.py) I am using python3.8.3 and latest version of ttkthemes

please help me. Thank u!

RedFantom commented 4 years ago

Hello! Thank you for including the snippet of code with your issue. If the issue occurs with this particular snippet of code, I think that the problem is not with ttkthemes.

Rather, it seems to me that you have named your test file ttkthemes.py. This will cause the from ttkthemes import ThemedStyle to import ThemedStyle from your snippet file. As this file is not done initializing (after all, it is still working on imports), this would be a circular import.

If you have named your file ttkthemes.py, try renaming it to, for example, scratch.py or snippet.py. If this is not the case, then I do not know how to reproduce the issue with the current code and further investigation will be necessary.