Post Reply 
Python: Is it possible to create/import/export .py files into the calculator
10-26-2021, 11:49 PM
Post: #1
Python: Is it possible to create/import/export .py files into the calculator
title.
Find all posts by this user
Quote this message in a reply
10-27-2021, 12:45 AM (This post was last modified: 10-27-2021 12:47 AM by toml_12953.)
Post: #2
RE: Python: Is it possible to create/import/export .py files into the calculator
(10-26-2021 11:49 PM)marethyu Wrote:  title.

Yes. What I do is to connect the calculator via USB, open the Connectivity Kit (CK), Start a new program in the kit (right click on the word program on the left side and click new) An entry box will appear on the right with a Main tab. Copy and paste the Python code from your text editor into the Main box on the right.. Insert the following line before the first line of your program:
Code:
#PYTHON name

Now, after the last line of your code add this:

Code:
#end
EXPORT pyhat()
BEGIN
  PYTHON(name);
END;
but change "pyhat" to the name of your program.

Click the double floppy icon at the top of the CK to save the program to the physical calculator.
Now you can run the Python program the same way as you run any other Prime program.

Tom L
Cui bono?
Find all posts by this user
Quote this message in a reply
10-27-2021, 03:34 AM
Post: #3
RE: Python: Is it possible to create/import/export .py files into the calculator
I see. Thanks for the reply!

By the way, where can I find extensive documentation for HP Prime Python? I want to know more about some built-in modules like `graphics` `hpprime`, and `cas`.
Find all posts by this user
Quote this message in a reply
10-30-2021, 03:29 AM
Post: #4
RE: Python: Is it possible to create/import/export .py files into the calculator
(10-27-2021 03:34 AM)marethyu Wrote:  I see. Thanks for the reply!

By the way, where can I find extensive documentation for HP Prime Python? I want to know more about some built-in modules like `graphics` `hpprime`, and `cas`.

Actually, I think it has the same stuff as standard MicroPython so whatever you learn with that should carry over, or at least mostly carry over if I'm not much mistaken.
Find all posts by this user
Quote this message in a reply
10-30-2021, 11:35 AM
Post: #5
RE: Python: Is it possible to create/import/export .py files into the calculator
Matplolib and other libraries are supported?
That would be very interesting (I have no prime)

HP71B 4TH/ASM/Multimod, HP41CV/X/Y & Nov64d, PILBOX, HP-IL 821.62A & 64A & 66A, Deb11 64b-PC & PI2 3 4 w/ ILPER, VIDEO80, V41 & EMU71, DM41X
Find all posts by this user
Quote this message in a reply
10-30-2021, 03:58 PM
Post: #6
RE: Python: Is it possible to create/import/export .py files into the calculator
(10-30-2021 11:35 AM)floppy Wrote:  Matplolib and other libraries are supported?
That would be very interesting (I have no prime)

It sure would be interesting but I haven't seen a way to add pre-compiled libraries. If there is a way, I wish someone would let us know. That would make it so much more useful!

Tom L
Cui bono?
Find all posts by this user
Quote this message in a reply
Post Reply 




User(s) browsing this thread: 4 Guest(s)