Thanks agaIn to Mr. K for answering all of my questions. Sometimes what I type does not equal what I think I have typed!
The text on the right side is right-justified using the #textwidth() function.
You will need the Ranchers font, downloadable from 1001 Fonts (1001fonts.com)
Code: Select all
' DigiClock by rbytes
' September 2017
' Quit by tapping the screen
#.scrview(#.normal)
days = ["Monday"," Tuesday"," Wednesday","Thursday","Friday","Saturday","Sunday"]
months = ["January","February","March","April","May","June","July","August","September","October","November","December"]
d,m,y = #.today()
n = #.weekday(d,m,y)
sw,sh = #.scrsize()
rw=sw/1232 ; rh=sh/813
#.fontname("Ranchers")
#.fontsize(100)
ap = ""
md = ""
sd = ""
#.scroff()
' main program loop
>
' end program if screen tapped
? #.tap(), #.end()
#.scrclear(0,0,0)
? sh>sw, port=1 ! port=0
year = y
month = m
date = d
day = n
hour,minute,second = #.now() ' returns current hour h, minute m and second s.
' Conversion to a 12-hour clock
? hour > 11
ap = "PM"
hour -= 12.
!
ap = "AM"
.
' SPL gives military time, so midnight to one am is 00 hours. Change to 12 hours.
? hour = 0, hour = 12
' add leading zero to minutes if needed
? minute < 10
md = "0"
!
md = ""
.
' add leading zero to seconds if needed
? second < 10
sd = "0"
!
sd = ""
.
'? port ' if device is in portrait mode
' draw year
#.drawcolor(1,.2,.2)
#.fontsize(180) 'FONT SIZE (140+port*30)*mc
#.drawtext(sw-50-#.textwidth(year),sh*.7,year)
' draw month and date
#.fontsize(140) 'DRAW FONT SIZE (110+port*15)*mc
dater = months[month]+" "+date
#.drawcolor(1,.8,0)
#.drawtext(sw-50-#.textwidth(dater),sh*.38,dater)
' draw day of week
#.drawcolor(.3,1,0)
#.fontsize(140)
#.drawtext(sw-50-#.textwidth(days[day]),sh*.1,days[day])
' draw am/pm
#.fontsize(120)
#.drawcolor(0,1,1)
#.drawtext(40,sh*.4,ap)
' draw hour and minutes
#.fontsize(220)
hourmin = hour+":"+md+minute
#.drawtext(40,sh*.65,hourmin)
' draw seconds
#.fontsize(160)
#.drawcolor(1,.3,1)
#.drawtext(40,sh*.1,":"+sd+#.int(second))
#.scr()
#.delay(.05)
<