Showing posts with label time module. Show all posts
Showing posts with label time module. Show all posts

Sunday, April 12, 2026

Numworks: Text Demos with a Poem and Rolling Screen Credits

Numworks: Text Demos with a Poem and Rolling Screen Credits 


The two scripts, which developed in Numworks:



nwtext1.py: Displaying a poem one line at a time.

nwtext2d.py: Presenting the credits in a classic TV show format.



They can be downloaded here:

https://drive.google.com/file/d/1IEDbLV4-mz9kngj0bBOkvBLrgKYg_5ha/view?usp=sharing



Display a Poem: newtext.py



Code:


# nwtext1.py

# Text Animation Demo 1

# Numworks

# Edward Shore, 2/18/2026



# import modules

from math import *

from kandinsky import *

from time import *



# Screen: 320 x 220 pixels



# list of text

t=['Roses are red','violets are blue','Nuwmorks is great','and so are you!']

# list of colors: red, violet, amber, ghost white

c=[(255,0,0),(178,0,237),(255,191,0),(245,245,245)]

# black background

fill_rect(0,0,320,220,(0,0,0))



# list the text

# each line is 20 pixels

for i in range(len(t)):

  # draw the string for each line

  # must include the black background

  # draw_string assumes white background if second color

  # is left off

  draw_string(t[i],60,60+20*i,c[i],(0,0,0))

  # time module's sleep

  sleep(1)



Notes:

1. Modules used: math, kandinsky, time. Math was entered by default every time a new script is started in Numworks. The kandinsky and time modules are specific to Numworks. The kandinsky module includes the drawing commands fill_rec and draw_string while the time module has the command sleep.

2. The line fill_rect(0,0,320,220,(0,0,0)) gives the drawing screen a black background.

3. The syntax for kandinsky’s draw_string is: draw_string(string of text, x y, text color, background color). The colors are optional, with the default set at black text color and white background. Since we have a black background for the entire screen, the background color (0,0,0) must be included.

4. To give readability I estimate that each line has a height of 20 pixels.



TV Screen Credits: nwtext2d.py





Code:

# nwtext2d.py

# Text Animation Demo 2

# Numworks

# Edward Shore, 2/19/2026



# Goal: give a classic TV style flashing of credits



# import modules

from math import *

from kandinsky import *

from time import *



# Screen: 320 x 220 pixels



# lists of text

# I'm not going to worry about center justification on this demo



# unicode for pi is u\03C0



# top line

t0=['CREDITS','Programmer','Supervisor','Directed By','Studio','Written By','A Pisces','']

# bottom line

t1=['','PI MAN','MS. SQUARE ROOT','PYTHAGOREAN THEOREM','SINE STUDIOS','PI MAN','Python Production 2026',':) \u03C0']

# black background in the loop, see comments





# roll credits

# each line is 20 pixels

for i in range(len(t0)):

  # draw a string for each line

  # text is in emerald green

  # background is black, must be included

  # since text is being replaced, we must refresh the      screen every time

  fill_rect(0,0,320,220,(0,0,0))

  draw_string(t0[i],40,60,(80,200,120),(0,0,0))

  draw_string(t1[i],40,100,(80,200,120),(0,0,0))

  # delay by 2 seconds

  sleep(2)



Notes:

1. Modules used: math, kandinsky, time. Math was entered by default every time a new script is started in Numworks. The kandinsky and time modules are specific to Numworks. The kandinsky module includes the drawing commands fill_rec and draw_string while the time module has the command sleep.

2. The line fill_rect(0,0,320,220,(0,0,0)) gives the drawing screen a black background.

3. The syntax for kandinsky’s draw_string is: draw_string(string of text, x y, text color, background color). The colors are optional, with the default set at black text color and white background. Since we have a black background for the entire screen, the background color (0,0,0) must be included.

4. In attempt to vertically center the credits, I put the top line at y = 60 and the bottom line at y = 100. In this demo, I did not worry about center justification, only choosing to left justify all the lines. The strings for the top line are stored in the list t0 while the strings for the bottom line are stored in the list t1.



I hope you enjoy these programs as I did making them,



Eddie

All original content copyright, © 2011-2026. Edward Shore. Unauthorized use and/or unauthorized distribution for commercial purposes without express and written permission from the author is strictly prohibited. This blog entry may be distributed for noncommercial purposes, provided that full credit is given to the author.



Sunday, December 20, 2020

Review: Swiss Micros DM41X

 Review: Swiss Micros DM41X






General Information


Company:  SwissMicros, https://www.swissmicros.com

Type:  Programmable Scientific

Memory:  319 registers (at default) - calculator; 32 MB external flash

Battery:  CR 2032

Date:  September 2020 - current

Cost:  229 CHF, about $257.34 according to currency converter on December 12, 2020 (https://www.xe.com/currencyconverter/convert/?Amount=229&From=CHF&To=USD)

Current Software Version:  2.1 (November 13, 2020)

Case Included?  Yes


The DM41X is a long waited calculator, and joins the DM 41L and DM41 family.  The family runs HP-41CX firmware, including a clock, time, and date functions.    On February 23, 2018, I reviewed the DM 41L which you can see here:


http://edspi31415.blogspot.com/2018/02/review-swissmicros-dm41l.html


I am going to address the features that are specific to the DM41X, which is added to all the great features of the DM41 and DM41L.  


A Return to the Original Layout





The DM41X's keyboard is in a portrait design, like the original Hewlett Packard HP-41C family (HP-41C, HP-41CV, HP-41CX)


Instead of the row of ON, USER, PRGM, and ALPHA keys on the top row, the DM41X adds a column of keys to the right of the main keyboard:


ON/CLK:  ON/OFF button, the shifted CLK displays the current time


USR/SETUP:  The user keyboard.  SETUP shows the DM41X's system menu where stve states and RAW progams can be saved, USB communication can be activated, modules can be saved and loaded, system settings can be changed, and accessing the About screen.


Blue Key:  This is the ALPHA key


Backspace Key


Up Arrow: for program scrolling and debugging


Down Arrow: for program scrolling and debugging


PRG/SIZE:  The PRGM button.  The shifted function allows the user set the number of registers to be set for numerical constants.


R/S/VIEW:  Run/Stop Key, View prompts for a view of a register's value without affecting the stack.


The Big Screen


The DM41X has three screen settings that is set by the DSP key:


1.  All four stacks, T, Z, Y, and X are displayed.  This is my preferred display. 


2.  The X stack and the Alpha Register are displayed.  On the top of the screen:  alarms, the number of storage registers designated for numerical constants, free memory, the current program loaded and it's pointer location.  


3.  Two stacks, Y and X are displayed. On the top of the screen:  alarms, the number of storage registers designated for numerical constants, free memory, the current program loaded and it's pointer location.  


Connectivity


The DM41X's connectivity interface is in line with the DM42's connectivity interface.  Simply plug the DM41X with a USB-Micro B port, then on the calculator press [shift], [USR] (SETUP), 1 for File, 5 for Activate USB Disk.  The DM41X now acts as a USB storage device like a smart phone.  


You can take screenshots by pressing and holding [SHIFT] and [DSP].  Screen shots are saved as .bmp files under the disk's SCREEN folder.


Black and white images of 400 x 240 pixels, 1 bit depth, .bmp format, can be saved to the disk's OFFIMG folder.  Every picture in the folder will be shown on a rotated basis every time the calculator is turned off.  


Custom Menu


Pressing the CST key will give you access to a custom menu 16 available slots for commands and programs.  CST also gives access to Help, ROM Map, and USB Disk activation.  To learn about how to set up the custom menu, click here:  https://edspi31415.blogspot.com/2020/10/swiss-micros-dm41x-custom-menus.html.


Programming


The DM41X operates like the HP-41CX in its programming language except the DM41X has a lot more room for ROM modules.


Verdict


Like the DM41L, the DM41X is a winner.  The keys feel good, I love seeing all four stack levels on the screen, and I am fan of the custom menu built into the DM41X.  This is definitely worth a purchase.


If the price tag of DM41X is too high, consider the DM41 or DM41L.  They may not have a four line display or a custom menu, but the high-quality calculator software and firmware is still present.  Currently only the DM41L is in stock from Swiss Micros, at CHF 129.  


- - - - - -


Announcement


This is the last post for 2020.  I want to wish everyone Merry Christmas, Happy Holidays, and Happy New Year.  2020 has been a brutal year in every respect.  May 2021 be free from disease, war, economic, social, and spiritual struggle; and be full of joy, health, and happiness.  Thank you to my blog's followers and readers; I appreciate all of you!  Take care, and the next schedule blog will be on January 2, 2021.  


Eddie


All original content copyright, © 2011-2020.  Edward Shore.   Unauthorized use and/or unauthorized distribution for commercial purposes without express and written permission from the author is strictly prohibited.  This blog entry may be distributed for noncommercial purposes, provided that full credit is given to the author. 


Friday, February 23, 2018

Review: SwissMicros DM41L

Review: SwissMicros DM41L





General Information

Company:  SwissMicros, https://www.swissmicros.com/
Type:  Programmable Scientific
Memory:  319 registers (2,233 steps),
(Firmware V 25 gives additional archive storage)
Battery:  CR 2032
Years:  Current (2015-)
Cost: $138 U.S. dollars (February 2018), 129 CHF

There are two models: the DM 41L and the DM41.  The DM41 is a credit card sized version of the DM 41L (99 CHF).  For me, I prefer the larger sized DM 41L as I do have large hands.  Both offer the same functionality. 

The size of the DM 41L is about the size of the Hewlett Packard HP 12C and HP 15C.

Note:  When I mention the DM 41L, this applies to both the DM 41L and the credit-card sized DM 41. 

The delivery for me (from Switzerland to the United States) was really fast, much faster than I expected.  I was motivated to purchase a DM 41L because I will turn 41 years old in March.  This is my first calculator from SwissMicros. 

The HP 41C Comes to the 21st Century

The DM 41L is a clone of the very popular HP 41CX calculator, but in a landscape form.  The HP 41CX was the final version of Hewlett Packard’s HP 41C series produced for most of the 1980s.  The HP 41CX included a time module, which gives the calculator a timer, stopwatch, and calendar operations.  Also the HP41CX included an extended functions and memory module.  The base HP 41C had 63 registers, while the HP41CX, and the DM 41L start you off with 319 registers.

Each register could either hold a number or seven program steps.  At any time you can designate how many registers to dedicate to holding numeric constants by executing the SIZE command.

The DM41L and DM 41 come with the following modules installed:

* Extended Memory and Functions (EX FCN 2D)
* Time Module (CX TIME)

I am so happy that the Time Module is included, because the DM41L has the days between dates function, so I don’t need to program the convert date to the Julian Date algorithm.  (I love the days between dates function, and I do feel that, and the date add functions should be standard on all calculators – OK, rant over).

Keyboard

The keyboard is a pleasure to use.  The colors of the fonts are beautiful, with the labels having great contrast between text and keyboard background.  The keys are very responsive and provide great feel for each press.  I have seen some reviewers comment that the keys are at first hard and need some breaking in, however, this is not the case for me. 

The only thing is that, I wish the ON button was the same height as the other keys, as the ON key is sunken a bit.  This could be personal preference as the ON key works just as well the rest of the keys.

Connectivity

The DM 41L can the connected to the computer where you can back up your memory, restore memory, load programs, and update the software.  The current version at the time of this review is Firmware 25.  Firmware 25 adds the X-Memory module, which allows for additional achieve memory. 

The cord used is a mini USB-RS232 cord, which is the same one used to connect the TI-84 Plus CE.

The Swiss Micros will have links to the required connectivity software and detailed instructions. It took me a little time to get the hang of it, it gets easier after I get the procedure. 

Get the DM 41L ready for connectivity use by having the calculator off, then holding the [ x ] (C) button and the [ ON ] button.

What Time Is It?

You can have the DM 41L tell you time and date by first having the calculator off, then holding the [ Σ+ ] (A) key, then the [ ON ]. 

In a similar fashion, you check the revision software by holding [ LN ] (E) then [ ON ].

SwissMicros’ other [ ON ] + key combos are listed here:  https://www.swissmicros.com/instructions.php

Programming

The DM 41L’s programming module is RPN keystroke, like the HP 41C.  If you know how to program the HP 41C, you can program the DM 41L.  Due to the popularity of the HP 41C, there is of ton of programming information online.  The Museum of HP Calculators has an entire software library thread dedicated to the HP 41C (http://www.hpmuseum.org/forum/forum-11.html ), which should work on the DM 41L with no problems.

A great online source to the programming and operating the HP 41C and the DM 41L can be found here:  http://www.greendyk.nl/hp41c-manual/index.php?s=J&p=7  Special thanks to Greendyk!   ( www.greendyk.nl )

Verdict

Do I recommend the DM 41L to purchase? 

That would be a 100% YES!

SwissMicros deserves all the praise from their customers, high quality calculator and high quality work.  I have very happy with my purchase. 

SwissMicros has several other calculators, including the DM 42 which was just released.  Please feel to check it out.

Eddie


This blog is property of Edward Shore, 2018.

Earth's Radius by Latitude

Earth's Radius by Latitude Introduction: Calculating the Earth’s Radius In quick, general calculations, we assume that the...