@@ -28,14 +28,24 @@ def lerp(start, stop, amt):
28
28
headerHeight = 30
29
29
30
30
# 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
32
32
# see more at https://www.drawbot.com/content/variables.html
33
33
Variable ([
34
34
dict (name = "year" , ui = "Slider" ,
35
35
args = dict (
36
- value = date .today ().year ,
36
+ value = date .today ().year + 1 ,
37
37
minValue = date .today ().year - 100 ,
38
38
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 )),
39
49
], globals ())
40
50
41
51
# convert the results of our slider to a rounded integer
@@ -79,7 +89,7 @@ def getHeaderFont():
79
89
# this is a list of week rows, and each week row is a list of days
80
90
thisCalendar = calendar .monthcalendar (year , month )
81
91
# make a new page
82
- newPage ('A2Landscape' )
92
+ newPage (int ( pageWidth ), int ( pageHeight ) )
83
93
frameDuration (1 / 2 )
84
94
fill (1 )
85
95
rect (0 , 0 , width (), height ())
@@ -170,4 +180,4 @@ def getHeaderFont():
170
180
# now we move down a row
171
181
translate (0 , - boxH )
172
182
173
- saveImage ('~/desktop/calendar.pdf' )
183
+ # saveImage('~/desktop/calendar.pdf')
0 commit comments