Python Programming
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me
Go Back   Dev Shed ForumsProgramming LanguagesPython Programming

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Dev Shed Forums Sponsor:
Get inside! Sample the range of functionality easily built with JMSL Library for Time Series Data Analysis, Heat Maps, Portfolio Optimization, Monte Carlo Simulation, Stock Price Charting and more. Download Now!
  #1  
Old December 4th, 2003, 05:50 PM
theparasiticmin theparasiticmin is offline
Junior Member
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Nov 2003
Posts: 3 theparasiticmin User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
pygame.display.update() parameters..

im just learning pygame, i made a small surface move around according to key board presses. i update the screen with pygame.display.update(). i learned however, that you can dictate which rect to update, making the processing faster. here is the code, then ill explain the problem..

PHP Code:
 import pygame
from pygame
.locals import *
pygame.init()
screen=pygame.display.set_mode((300,300))
player=pygame.Surface((20,20)).convert()
player.fill((255,255,255))
prct=player.get_rect()
while 
1:
    for 
event in pygame.event.get():
        if 
event.type==KEYDOWN:
            if 
event.key==K_UP:
                
prct=prct.move([0,-1])
            if 
event.key==K_DOWN:
                
prct=prct.move([0,1])
            if 
event.key==K_RIGHT:
                
prct=prct.move([1,0])
            if 
event.key==K_LEFT:
                
prct=prct.move([-1,0])
    
screen.fill((0,0,0))
    
screen.blit(player,prct)
    
pygame.display.update() 


when i put in prct as the parameter in update, nothing is updated, all of the white boxes remain. when i enter player.get_rect() as the parameter, the box can move, but it moves in this frame which is basically the original box outline. thats the only place its visible, inside the original outline. once it moves out, it starts to disapear. how is this supposed to work?

Reply With Quote
Reply

Viewing: Dev Shed ForumsProgramming LanguagesPython Programming > pygame.display.update() parameters..


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 2 hosted by Hostway