[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]
[pygame] Question about timing
- To: pygame-users@xxxxxxxx
- Subject: [pygame] Question about timing
- From: "Francesco Martino" <francesco.k@xxxxxxxxx>
- Date: Mon, 12 May 2008 15:57:30 +0200
- Delivered-to: archiver@xxxxxxxx
- Delivered-to: pygame-users-outgoing@xxxxxxxx
- Delivered-to: pygame-users@xxxxxxxx
- Delivery-date: Mon, 12 May 2008 09:57:49 -0400
- Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:received:message-id:date:from:to:subject:mime-version:content-type; bh=v+xsY/whvWYJhPpvvvpGtPt689KinIwrlaNDWPHf4IQ=; b=M73/HJQx3JZ7ylu6G9ADaAhXCYdN+rqTcFN4qyun/Q7Zc2eqgodr16jiDTlZVfAVz7PFrskVD0eGH4Odt6NyaLVOX75wermKzfzJO8gtfzrZY5AG/WzEsj+R7q60rvB7yb++E1rns6P/yNs0FS/Fsdc1KhxuGRbcICRE7srzBPs=
- Domainkey-signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=message-id:date:from:to:subject:mime-version:content-type; b=wjq4aRWOCw9VGHsDb4BYYQ6+RRTW5mTxN+VU+ZuSuQa+MUScaBsjNurvVCrbqcCM/nYyRjGdGWFk7SCs8+gvmMiCvsTXh8V47Q3jDgL1D9YQUNHQePl3HSs/5fRWJnsnGY7kKijG3+LlL96ZXAvFFwg+DEU7gZjAHQ6xl7iu6c8=
- Reply-to: pygame-users@xxxxxxxx
- Sender: owner-pygame-users@xxxxxxxx
Sorry if my question is silly, but maybe I didn't catch very much some question about pygame.time module.
I am writing an application which needs to very accurate about timing; it displays sequentially some images, each one of them remaining on the screen for a constant time T.
This is a part of the code I wrote to understand how time module works:
*********************************************************************
clock = time.Clock()
while 1:
clock.tick
msec = clock.get_time()
print "1. msec = %i" %msec # these lines has been written just to see what is returned by get_time()
for event in pygame.event.get():
if event.type == QUIT:
exit()
surf.fill((255,255,255,255)) # these lines has been written just to see what is returned by get_time()
msec = clock.get_time()
print "2. msec = %i" %msec
*********************************************************************
This is the output of th application:
1.msec = 1767859565
2.msec = 1767859565
1.msec = 1767859565
2.msec = 1767859565
1.msec = 1767859565
2.msec = 1767859565
....
My problem is that I cannot understand what type is returned by get.time():
at http://snipurl.com/28h08, it is reported that this method returns an int
at http://snipurl.com/28h0t , it is reported that this method returns milliseconds.
My other question is: is it possibile to transform milliseconds type into an int?
I am using Pygame 1.7.1
Thank you in advance for any help you can provide me,
Francesco