Discuss how to use the Ren'Py engine to create visual novels and story-based games. New releases are announced in this section.
Forum rules
This is the right place for Ren'Py help. Please ask one question per thread, use a descriptive subject like 'NotFound error in option.rpy' , and include all the relevant information - especially any relevant code and traceback messages. Use the code tag to format scripts.
-
Nanahs
- Veteran
- Posts: 310
- Joined: Wed Aug 22, 2018 5:50 pm
-
Contact:
#1
Post
by Nanahs » Wed Sep 05, 2018 10:20 am
I've seen some really good clock tutorials here.
But I wanted one that would look like this:
A real time one (import real time). That would only show the hour and the minute.
It doesn't need to be inside of a box or anything. Just show it like that (picture above).
Does anyone know how I can do that?
Thanks xx
Last edited by
Nanahs on Fri Oct 05, 2018 5:03 pm, edited 1 time in total.
-
DannX
- Regular
- Posts: 99
- Joined: Mon Mar 12, 2018 11:15 am
-
Contact:
#2
Post
by DannX » Wed Sep 05, 2018 10:49 am
This is the method I've been using to get the time and it seems to work well, there are probably other (maybe better) ways, but here it is:
Code: Select all
init python:
import time
def get_current_time():
return time.strftime('%H:%M')
screen my_clock():
$ hour = get_current_time()
text hour xalign .99
timer .01 repeat True action SetScreenVariable('hour', get_current_time())
-
IrinaLazareva
- Veteran
- Posts: 399
- Joined: Wed Jun 08, 2016 1:49 pm
- Projects: Legacy
- Organization: SunShI
- Location: St.Petersburg, Russia
-
Contact:
#3
Post
by IrinaLazareva » Wed Sep 05, 2018 11:55 am
little update:
Code: Select all
init python:
import time
def mytime(st, at):
return Text(time.strftime('%H:%M'), size=30), 0
image mytimes = DynamicDisplayable(mytime)
then just...
Code: Select all
label start:
show mytimes at topright
or with screen...
Code: Select all
screen jclock():
add 'mytimes' at topright
label start:
show screen jclock
-
DannX
- Regular
- Posts: 99
- Joined: Mon Mar 12, 2018 11:15 am
-
Contact:
#4
Post
by DannX » Wed Sep 05, 2018 12:34 pm
IrinaLazareva wrote: ↑Wed Sep 05, 2018 11:55 am
Code: Select all
init python:
import time
def mytime(st, at):
return Text(time.strftime('%H:%M'), size=30), 0
image mytimes = DynamicDisplayable(mytime)
Ah, I knew there had to be a less redundant way, this is so much better!
Thank you IrinaLazareva! I'll update mine too!
-
Nanahs
- Veteran
- Posts: 310
- Joined: Wed Aug 22, 2018 5:50 pm
-
Contact:
#5
Post
by Nanahs » Wed Sep 05, 2018 8:29 pm
Thank you guys! I'll give it a try

Users browsing this forum: Bing [Bot], Google [Bot], _ticlock_