jarvisteach / appJar

Simple Tkinter GUIs in Python

Home Page:http://appJar.info

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Autoentry with empty initial list error

regob opened this issue · comments

Bug Report

If I create an Autoentry with an empty list, and then I want to change its list, I get an error, that the entry is not an Autoentry.

Any error messages produced by appJar

appJar:ERROR [Line 1733->10123/changeAutoEntry]: You can only change items in an AutoEntry, A is not an AutoEntry.

Sample code, demonstrating the issue

from appJar import gui

app = gui(" ", "400x200")

app.addAutoEntry("A", [])
app.changeAutoEntry("A", ["asdfd", "qwerty"])

app.go()

What steps are needed to reproduce the bug

Run the sample code.

Version Information

appJar: 0.94.0 Python: 3.6.10 TCL: 8.6, TK: 8.6 Platform: Linux pid: 13020
locale: en_US

You're right!

This is by design, but I think the design is wrong:

if len(words) > 0:
             ent = self._makeAutoCompleteEntry()(words, self._getTopLevel(), frame)
         else:
             var = StringVar(self.topLevel)
             ent = entryBase(frame, textvariable=var)

It currently uses the length of the words variable to determiner the type of entry.

That should be changed.