Posté le 21/08/2022 13:35
Planète Casio v4.3 © créé par Neuronix et Muelsaco 2004 - 2024 | Il y a 238 connectés | Nous contacter | Qui sommes-nous ? | Licences et remerciements
Planète Casio est un site communautaire non affilié à Casio. Toute reproduction de Planète Casio, même partielle, est interdite.
Les programmes et autres publications présentes sur Planète Casio restent la propriété de leurs auteurs et peuvent être soumis à des licences ou copyrights.
CASIO est une marque déposée par CASIO Computer Co., Ltd
Citer : Posté le 27/08/2022 14:13 | #
Thanks for mentioning the version and option, we can never have too much notes on building MicroPython!
I was really convinced you could... now I'm disappointed you can't!
Right, an add-in could access the captures (although only libfxcg has the APIs for it right now) so it's easier than the PC. But then if you have an add-in we might as well use a different version of Python. You see, when dealing with these kinds of problem in the old BASIC days, using add-ins wasn't an option because many models didn't support them. But now every officially-Python-supporting CASIO calculator also has add-ins, so we can just hammer away at our problems with C. x)
Ultimately I agree with you it's much simpler to save data from an add-in, it's just that not everyone knows how to write them.
* builtin stuff: open, with, iteration (such as for loops)
* os/os.path: listdir, remove, exists, getsize. These methods are available once a filesystem has been imported, such as: from filesystem_module_name import MPFS
* io: read, readall, readline, readlines, seek, tell, close. These methods may be called on the Mpfs object returned from open()
That's quite a bit actually! It also seems enough to implement robust asset loading with some sweet automation... and compression too, dang. :o
Citer : Posté le 28/08/2022 01:10 | #
mpfs is now available on GitHub: mpfs: MicroPython File System
“They call me the king of the spreadsheets, got 'em all printed out on my bedsheets.” — “Weird Al” Yankovic
Citer : Posté le 28/08/2022 22:02 | #
Made another image converter, here. This one doesn't try to compress. Instead, it creates a Python string for a B&W image that is valid in both Python 3 and MicroPython and remains intact after being saved in Visual Studio Code. It saves the image 7 bits at a time. Then, it attempts to find an offset it can add to each byte (mod 128) that will result in no restricted characters being used (NUL, CR, LF, ", \). For most small and non-random images this will probably be successful, however it's not guaranteed.
The first byte of the string is the (offset + 1), the 2nd is the image width, and 3rd is image height. Then, the image bytes follow.
Here's a minified function to draw such an image:
o,w,h=i[0:3];o-=1;w=(w-o)%128;h=(h-o)%128;z=0;u=0
for j in range(3,len(i)):
v=(i[j]-o)%128
for _ in range(7):
p=v&1;v>>=1
if p:set_pixel(x+z,y+u)
z+=1
if z>=w:z=0;u+=1
if u>=h:return
Note: The offset, width and height can also just be hardcoded in the program using the image, rather than being stored in the Python string, making draw_image() smaller.
“They call me the king of the spreadsheets, got 'em all printed out on my bedsheets.” — “Weird Al” Yankovic
peppe.pisanu Invité
Citer : Posté le 10/10/2023 17:47 | #
can you make it a program