简体   繁体   中英

APPJAR PYTHON how to create a table for preset data?

I've tried creating a table using the .addTable() function but it doesn't seem to recognise this command, is this not the correct command as it says on the appjar website.

from appJar import gui

app = gui()
app.setFont(20)
app.addTable("g1",
             [["Name", "Age", "Gender"],
             ["Fred", 45, "Male"],
             ["Tina", 37, "Female"],
             ["Clive", 28, "Male"],
             ["Betty", 51, "Female"]])
app.go()

the error I get is shown below:

Warning - Unknown function:addTable ('g1', [['Name', 'Age', 'Gender'], ['Fred', 45, 'Male'], ['Tina', 37, 'Female'], ['Clive', 28, 'Male'], ['Betty', 51, 'Female']]) {}

It seems like you are running Python 2 but only installed appJar for Python 3.

Try installing appJar for Python 2. pip2 install appJar

Or try running it in Python 3. python3 filename.py

Also, try running python --version and pip --version . That may clear up some confusion for you.

It may be your version of appJar - in earlier versions, the table was called grid - so you could try calling .addGrid() instead, or try updating appJar:

sudo pip install appJar --upgrade

Or, download the newest zip file.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM