Major error in ttkboostrap
See original GitHub issueDesktop (please complete the following information):
Hi,
I use the following code to spawn the next UI, but iam getting error _tkinter.TclError: NULL main window
from tkinter import *
from ttkbootstrap import Style
from tkinter import ttk
import multiprocessing
class GuiApp(object):
def __init__(self):
self.style = Style(theme='litera')
self.style.configure('lefttab.TNotebook', tabposition='wn')
self.style.configure('TNotebook.Tab', align=LEFT)
self.root = self.style.master
tabone = ttk.Button(self.root, text="Campaigns")
tabone.place(x=20, y=20)
tabtwo = ttk.Button(self.root, text="Settings")
tabtwo.place(x=27, y=60)
self.root.geometry("850x550")
self.root.resizable(False, False)
def validate():
second.destroy()
multiprocessing.freeze_support()
gui = GuiApp()
gui.root.mainloop()
def validate_lic():
global second
global emailentry
global passentry
global keyentry
global validate_btn
style = Style(theme='litera')
second = style.master
validate_btn = ttk.Button(second, text="Sign-in", command=validate)
validate_btn.place(x=155, y=150)
second.geometry("350x300")
second.resizable(False, False)
# second.iconbitmap("Icon.ico")
second.mainloop()
if __name__ == '__main__':
multiprocessing.freeze_support()
validate_lic()
If i tried with same code with ttkboostrap version 0.5.1 then no issue.
Describe the bug
Getting _tkinter.TclError: NULL main window bug when it was trying to spawn other UI
To Reproduce
Just run the code and click on sign in button, you can see the bug
Expected behavior
It has to spawn the other UI, it works fine V0.5.1, but not in the current.
Screenshots
https://i.imgur.com/8zaETCY.png
Additional context
No response
Issue Analytics
- State:
- Created a year ago
- Comments:11 (6 by maintainers)
Top Results From Across the Web
ttkbootstrap not working with pyinstaller - Stack Overflow
json over to the folder, which required me to bring over Symbola.ttf as well. Once done, run pyinstaller main.spec on elevated command prompt....
Read more >I can't executable with ttkbootstrap library · Issue #43 - GitHub
try running using the command python main.py . All reactions.
Read more >Reference — ttkbootstrap documentation - Read the Docs
class ttkbootstrap. ... This class is an iterator, so you can iterate over the main style color labels ... It is an error...
Read more >ttkbootstrap - PyPI
A supercharged theme extension for tkinter that enables on-demand modern flat style themes inspired by Bootstrap. Check out the documentation.
Read more >Ttkbootstrap installation and list of available styles ... - YouTube
00:00 Sample application demo using Ttkbootstrap 00:50 PIP installation of ttkbootstrap01:05 Blank window using ttkboostrap02:06 Placing ...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Ok, Thanks @israel-dryer
Thank you for your excellent support
I need to look into this further, but generally, it is not a recommended practice to use more than one tcl/tk interpreter in your application. This is what
Toplevel
widgets are created for. There are several ways to accomplish what you want without closing and reopening a new application window.On solution, as I mentioned, is to use
Toplevel
widgets. Another solution (demonstrated below) is to use frames to control and contain your content.In fact, since you are creating your own notebook buttons, you really do not need to use the notebook widget at all, just use the
pack_forget
method to remove the frame from the window as I did for the license frame above, and then pack the tab you want to show. The result will be the same except you won’t need to do a lot of customizations on the notebook widget.One other tip, I would avoid using place with x & y coordinates. If someone has a high resolution screen, the placement of widgets will be very different than you expect. If you need to use the
place
geometry manager, prefer to use relx or rely to make relative position placements.here’s with just the tabs