Closed jeevanholla closed 6 years ago
This looks to be a problem with .destroySubWindow()
not properly destroying the labelled widget.
I'll have a look into it in the next couple of days. Instead of destroying the subWindow, you could simply hide & show it again...
OK, I've patched next_release
, when a labelBox is created, an entry is put in both FrameLabels
& Labels
but only the FrameLabel
was being destroyed. Now, both are bing destroyed.
from appJar import gui
def launch(win): app.startSubWindow(win, modal=True) app.addLabelEntry("Window one") #LabeledEntry considered as duplicate app.addButton("close window", destroyWindow) app.stopSubWindow() app.showSubWindow(win)
def destroyWindow(btn): app.destroySubWindow("one")
app=gui() app.setSize(400, 600) app.setSticky("nw") app.startFrame("LEFT", row=0, column=0)
these go in the main window
app.addButton("one", launch)
app.go()
In this case Button "one" can be pressed only once. gui will save labelentry "Window One" and reports it as duplicate when we press button on second time. This doesnt happen with addLabel option. Below is the trace back seen in the case of second press of same button
Exception in Tkinter callback Traceback (most recent call last): File "C:\Python27\lib\lib-tk\Tkinter.py", line 1542, in call return self.func(args) File "C:\Python27\lib\site-packages\appJar\appjar.py", line 3574, in
return lambda args: funcName(param)
File "C:/Users/jholla/PycharmProjects/app_window_test/test_app_window.py", line 5, in launch
app.addLabelEntry("Window one")
File "C:\Python27\lib\site-packages\appJar\appjar.py", line 9167, in addLabelEntry
return self._entryMaker(title, row, column, colspan, rowspan, secret, label=label)
File "C:\Python27\lib\site-packages\appJar\appjar.py", line 9130, in _entryMaker
frame = self._getLabelBox(title, label=label, **kwargs)
File "C:\Python27\lib\site-packages\appJar\appjar.py", line 5471, in _getLabelBox
self.widgetManager.verify(self.Widgets.Label, title)
File "C:\Python27\lib\site-packages\appJar\appjar.py", line 14889, in verify
raise ItemLookupError("Duplicate widgetName: " + widgetName)
ItemLookupError: Duplicate widgetName: Window one