I have tried searching the manual for a simple action...
I want to store variables in an array, I found and implemented many ways of doing this
Creating the array
Creating the first elements is easy with variablesarray.append(list)
I can even read them back with variablesarray[x][y]
But I cannot for the life of me figure out how to change an element in the array
In my old basic world it was very simple variablesarray[x][y]=newvalue
How can I achieve this simple variable change in Python, what am I missing.
I am confident it will be something simple... but I have yet to discover it.
Pointers gratefully received...
And the more I experience them the more, I am impressed by the body of dedicated helpers (hero’s) in this forum. I hesitate to name names as there are many willing tutors/heros.
I only hope that the continuous drip feed of totally incompetent (really need help...often me!) and blindingly obviously lazy forum users don’t wear the hero’s out.
- Read and re read the Welcome Text
- Read the “extensive documentation”
- Make extensive use of the Examples
Only then come to the forum.. for answers
I recently read another clue, to solving your own problems.
Start simple, decompose the problem into smaller chunks., and resolve one chunk st a time.
Starting complex never helps anyone.... so Why oh Why do I always do it!
Recently I fell foul of my own Rule 1
Of course @omz would put how to give beta feedback in the Welcome text!
Spotted your pointer to the GitHub humberry UI Tutorial, excitedly skipped over to GitHub
As I really do want to “get” using pyui’s....
Aargh! New Brick Walls!
It may sound simple but how do I get a GitHub resident PYUI file to my iPad.
You cannot imagine what I have tried so far, including forking the Tutorial!
@omz Having downloaded the beta, the Calculator example now bombs with:
Traceback (most recent call last):
File "/var/containers/Bundle/Application/AA2AD925-136B-48E0-80AA-xxxxxxxxxxx/Pythonista3.app/Frameworks/Py3Kit.framework/pylib/site-packages/ui.py", line 412, in load_view
return load_view_str(json_str, bindings, stackframe, verbose=verbose)
File "/var/containers/Bundle/Application/AA2AD925-136B-48E0-80AA-Xxxxxxxxxxx/Pythonista3.app/Frameworks/Py3Kit.framework/pylib/site-packages/ui.py", line 398, in load_view_str
return _view_from_dict(root_view_dict, g, l, verbose=verbose)
File "/var/containers/Bundle/Application/AA2AD925-136B-48E0-80AA-xxxxxxxxxxxx/Pythonista3.app/Frameworks/Py3Kit.framework/pylib/site-packages/ui.py", line 379, in _view_from_dict
subview = _view_from_dict(d, f_globals, f_locals, verbose=verbose)
File "/var/containers/Bundle/Application/AA2AD925-136B-48E0-80AA-xxxxxxxxxxxx/Pythonista3.app/Frameworks/Py3Kit.framework/pylib/site-packages/ui.py", line 321, in _view_from_dict
_bind_action(v, attrs.get('action'), f_globals, f_locals, verbose=verbose)
TypeError: my_bind_action() got an unexpected keyword argument 'verbose'
(I xxxxxx’d out a part of my iPad I’d, I am that paranoid!)
I tried copying the calculator.pyui file from my non upgraded iPhone into my iPad in case I had corrupted the pyui file, I got the same error.
In my own very simple coding activities I have yet to bump into a beta error.
I posted here as I cannot find instructions on how to report beta problems. sorry...
OMG why did I try a read the manual, I found a part in the manual that showed me that *100 would not work!?
And yet it all did!
a=*100 print(a) a=1 print(a) a=a+1 print(a) b=['']*100 print(b) b='test' print(b) b=b+'again' print(b)
Btw I wasn’t trying to do a sort that was just a historical side comment, but thanks for the pointer, stored for future reference.
I wish to create a blank array of 100 elements
Where blank is either Integer 0 or Empty string ‘“” (two different use cases)
Then I wish to write to specific elements in the array
Either replacing the elements or adding/appending to them
Having read and re read the documents
I have not been able fathom how to accomplish these tasks.
I recall in Algol that this was a trivial task, it was how I ”cheated” doing a sort task,
According to my professor in doing a sort. He wanted a bubble sort.
I simply wrote the numbers into an array where n= array element, and then read them out
How!? In Python?
Is a command missing from the documentation?
.... love your blog comments.
Presumably someone sad thought they were clever writing a python script to Spam this forum.
Well done you’ve proved you can do it...
Otherwise I would appreciate if someone else with admin rights wrote a script to expunge these posts.
I’ll keep flagging them for moderation in the interim.