Portail de ressources

Vous pouvez télécharger ici de nombreuses ressources pour la classe

 

Faites votre recherche ci-dessous à l'aide des filtres disponibles et consultez gratuitement de nombreuses

Dashboards made easy with creating textboxes on TI-Nspire CXII canvas

This resource provides a textbox() object module along with examples, to be used on TI-Nspire CXII to write text to the Canvas display in a dashboard like layout.

Auteur: Hans-Martin Hilbig, John Hanna

Sujet:  STEM

Tags  Coder ,  Collecte de données ,  STEM ,  Python

textbox() module to ease the creation of 'dashboard gauges' on the TI-Nspire CXII canvas. Save textbox.tns to your Pylib folder and refresh libraries.

NEW: Version 1.2: getinput() method has been expanded to block ‘bad’ keys like <center>,<left>,<right>, etc  and pi, exp, square, 10power are replaced with proper symbols to support input of mathematical expressions by getinput().

See textbox_demo.tns for examples. Save textbox_demo.tns to your Python folder.


Constructor:
var = textbox(row,col): create a textbox object starting at (row, col): there are 13 rows & 32 columns. Default textbox size: 5 rows, 10 cols. Use either .println() or .refresh() to make it appear.

Methods:
.size(rows,cols): size of the textbox, where rows can be between 1-13 and cols between 1-32. Default: 5 rows, 10 cols. Re-sizing (to a smaller size) requires a complete repaint of the screen.

.title('text'): assigns a title to the textbox() object. Displayed above the textbox, so if you use a title, the textbox should start on row 2 to see the title.

.set_colors(textcolor, backcolor): use two tuples such as: mybox.set_colors((255,0,0),(0,255,0))

.set_border(True/False): True draws a border around textbox, including title

.getinput(): temporarily converts the textbox to an input box. Accepts any input from keyboard. A blinking cursor indicates textbox is waiting for input. <del> or <backspace> deletes last character input. <esc> cancels getinput(), returning 'cancel' as a string. <enter> terminates getinput() and returns a string or "" if nothing was input. Last line of textbox prior to getinput() is preserved and can be used as an input query. Alternatively, change title() of textbox to a query text before calling getinput(). Use.clr() before .getinput() to make textbox a fresh input box without any text written to it.

.grid(): prints numbers on the top and left side of the canvas to ease textbox() placement during code development. Use with any one textbox object.

.println('text'): prints 'text' in textbox, with wrapping (text, not word!) if width of the 'text' exceeds width of the textbox. If all rows of textbox are used, text is scrolled up one line, with the old top line being lost and the last new line being the text of println(). Argument must be a string. This is the heart and soul of the code.

.time(): returns a string with the current system time, in a hh:mm:ss format. Can be used with .println() to print a time stamp in the textbox object.

.date(): returns a string with the current system date, in a mm/dd/yyyy format. Can be used with .println() to print the current date in the textbox object.

.dot(): adds a '.' (dot) to a previously printed line of text (useful to create walking dots to a 'status' or 'progress' box). Tip: use only 1 line in the box.

.clr(): clears contents of the textbox() object. Use before a .getinput() statement to suppress the previously entered info.

.ver(): returns the current version of the textbox() module

textbox() class by Hans-Martin Hilbig, Jan 2021
revisions by John Hanna, Feb 2021

License not specified

Documents: