Skip to content

Commit 4d4d8b6

Browse files
committed
add a few other variables
1 parent f488cab commit 4d4d8b6

File tree

1 file changed

+14
-4
lines changed

1 file changed

+14
-4
lines changed

session-5/misc/calendar.py

+14-4
Original file line numberDiff line numberDiff line change
@@ -28,14 +28,24 @@ def lerp(start, stop, amt):
2828
headerHeight = 30
2929

3030
# instead of hardcodin the year, let’s make a slider
31-
# this is a silly use case but oh well i wanted to show it to you
31+
# this is a silly use case since these are much better controlled numerically but oh well i wanted to show it to you anyway
3232
# see more at https://www.drawbot.com/content/variables.html
3333
Variable([
3434
dict(name="year", ui="Slider",
3535
args=dict(
36-
value=date.today().year,
36+
value=date.today().year+1,
3737
minValue=date.today().year-100,
3838
maxValue=date.today().year+100)),
39+
dict(name="pageWidth", ui="Slider",
40+
args=dict(
41+
value=sizes('A2Landscape')[0],
42+
minValue=72,
43+
maxValue=1000)),
44+
dict(name="pageHeight", ui="Slider",
45+
args=dict(
46+
value=sizes('A2Landscape')[1],
47+
minValue=72,
48+
maxValue=1000)),
3949
], globals())
4050

4151
# convert the results of our slider to a rounded integer
@@ -79,7 +89,7 @@ def getHeaderFont():
7989
# this is a list of week rows, and each week row is a list of days
8090
thisCalendar = calendar.monthcalendar(year, month)
8191
# make a new page
82-
newPage('A2Landscape')
92+
newPage(int(pageWidth), int(pageHeight))
8393
frameDuration(1/2)
8494
fill(1)
8595
rect(0, 0, width(), height())
@@ -170,4 +180,4 @@ def getHeaderFont():
170180
# now we move down a row
171181
translate(0, -boxH)
172182

173-
saveImage('~/desktop/calendar.pdf')
183+
#saveImage('~/desktop/calendar.pdf')

0 commit comments

Comments
 (0)