jarvisteach / appJar

Simple Tkinter GUIs in Python
http://appJar.info
Other
615 stars 68 forks source link

GetAllInputs errors when fields are blank #563

Closed rameyst closed 5 years ago

rameyst commented 5 years ago

Bug Report


Context


Getting all the entry fields on the app, then creating a table in sqlite database. The table's columns are the key values of the input fields

Expected Behaviour


Entry fields names should be captured by the getallinputs with or without null values in the input boxes

Actual Behaviour


An error occurs because the getallinputs doesn't capture the inputs into the dict variable

Any error messages produced by appJar


Exception in Tkinter callback Traceback (most recent call last): File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/tkinter/init.py", line 1705, in call

return self.func(*args)

File "/Users/username/PycharmProjects/DFdec/venv/lib/python3.7/site-packages/appJar/appjar.py", line 3574, in return lambda *args: funcName(param) File "/Users/username/PycharmProjects/DFdec/venv/decform.py", line 31, in initializedb dbcur.execute(strcreatetable) sqlite3.OperationalError: near ")": syntax error

Sample code, demonstrating the issue


Replace this with a cut-down version of code, that demonstrates the issue.

What steps are needed to reproduce the bug


create an gui with a few input boxes and a button, buttons onclick event should getallinputs (be sure to leave all them blank). then attempt to access the keys portion of the dictionary

entries = app.getAllInputs() columns = ','.join(entries.keys()) print(columns)

columns should be blank

Version Information


v.93 python 3.7.2

jarvisteach commented 5 years ago

Hi @rameyst - the getAllInputs() function is working as expected, it just doesn't include empty input widgets.

As this functionality has existed for a while, I'm loathe to change it. But, we could add a flag to the call, allowing you to specify if you want to include empty fields - and default this to False?

jarvisteach commented 5 years ago

NB. This is only true of getAllInputs(), if you call getAllEntries() that does return empty entries too.

jarvisteach commented 5 years ago

Now included as a flag in the next release.