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

enter title of bug here #600

Open
zhx17787891171 opened this issue Sep 22, 2024 · 5 comments
Open

enter title of bug here #600

zhx17787891171 opened this issue Sep 22, 2024 · 5 comments
Labels
bug Something isn't working

Comments

@zhx17787891171
Copy link

Desktop (please complete the following information):

window,1.10.1

Describe the bug

from ttkbootstrap import Style
Style()
import tkinter
root = tkinter.Tk()
lab=tkinter.Label(root,text="123")
lab.pack()
root.mainloop()

Two windows will appear in this code

To Reproduce

No response

Expected behavior

No response

Screenshots

No response

Additional context

No response

@zhx17787891171 zhx17787891171 added the bug Something isn't working label Sep 22, 2024
@rdbende
Copy link

rdbende commented Sep 22, 2024

Put Style() after root = tkinter.Tk() in your code.

@gtgor
Copy link

gtgor commented Nov 1, 2024

This is a problem with tkinter, and debugging shows that mainloop recognizes style as a window

@rdbende
Copy link

rdbende commented Nov 3, 2024

It is not by accident. If you put it before root = tkinter.Tk(), tkinter will create a main window automatically for the Style() to operate on.

Hence I said:

Put Style() after root = tkinter.Tk() in your code.

@gtgor
Copy link

gtgor commented Nov 3, 2024

Obviously, tkinter.tk() instantiated Style() when it was created

@gtgor
Copy link

gtgor commented Nov 4, 2024

style() is essentially a tkinter wrapped control that has globally modified all variables with the tk property, so starting tk.windows () when style() is called will naturally cause the style to run as a separate window. The ttk library doesn't have much support for older widgets. It's a refactored library that inherits from tkinter, and if you want to use both, bugs are not unusual

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

3 participants