Welcome!
This is the community forum for my apps Pythonista and Editorial.
For individual support questions, you can also send an email. If you have a very short question or just want to say hello — I'm @olemoritz on Twitter.
[SOLVED!] Help with console error (short code)
-
New project. It ask for the date of an event and counts the days till that event!
Please help with the error.
Thanks in advance!
Here's the code:
<code><pre>
import datetime
import console
from scene import *
class question (Scene):
def setup(self):
self.show_instructions = True
self.particles = set()
self.p_size = 64 if self.size.w > 700 else 32
def draw(self):
background(0, 0, 0)
if self.show_instructions:
s = 40 if self.size.w > 700 else 17
event = console.input_alert('Event', 'Please enter the event name.\ni.e. First day of school', '', 'Enter')
today = datetime.date.today()
find = console.input_alert('Date', 'Please enter the date you would like to countdown to.\ni.e. 2009 (year),6 (month),29 (day)', '', 'Enter')
try:
year, month, day = [int(s.strip()) for s in find.split(',')]
someday = datetime.date(year, month, day)
diff = someday - today
print(diff.days)
except ValueError:
print 'Incorrect date format (must be "year, month, day")'
run(question())
</code></pre> -
-
You're a legend!