From 2e5f6f61ff865d9115a3a11294d9405b4c3e99f7 Mon Sep 17 00:00:00 2001 From: Richard Jarvis Date: Sun, 4 Mar 2018 21:46:54 +0000 Subject: [PATCH] #401 better handles none text containing widgets --- examples/issues/issue401.py | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/examples/issues/issue401.py b/examples/issues/issue401.py index 06151e8..598dab2 100644 --- a/examples/issues/issue401.py +++ b/examples/issues/issue401.py @@ -7,7 +7,11 @@ def __init__(self, topLevel): self._topLevel = topLevel def buildTag(self, tag, data, details): - xml = "<" + tag + ">" + "" + data + "" + details + "\n" + xml = "<" + tag + ">" + if data is not None: + xml += "" + data + "" + xml += details + xml += "\n" return xml def getClass(self, widg): @@ -19,11 +23,10 @@ def getClass(self, widg): def getText(self, widg): try: - text = widg.cget('text') + text = widg.cget('text').replace("&", "&") if text == "": text = "-EMPTY-" - except: text = "-NONE-" - text = text.replace("&", "&") - return text + return text + except: return None def getDetails(self, widg): try: @@ -82,3 +85,5 @@ def makeExplorer(): with app.subWindow("sub"): app.label("in sub") + + app.addStatusbar()