Python Forum
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
error with survace.blit
#1
So Ive been playing with pygame recently and ive came across this error, any help?

Traceback (most recent call last):
File "C:\Users\joemc\Desktop\Rpg\main.py", line 59, in <module>
window.blit(Sky)
TypeError: function missing required argument 'dest' (pos 2)

Here is the code...

import pygame
import sys
import time
from s.UltraColor import *
from s.textures import *

pygame.init()

cSec = 0
cFrame = 0
FPS = 0

tile_size = 32

fps_font = pygame.font.Font("C:\\Windows\\Fonts\\Verdana.ttf", 20)

sky = pygame.image.load("sky.png")
Sky = pygame.Surface(sky.get_size(), pygame.HWSURFACE)
Sky.blit(sky, (0, 0))
del sky

def show_fps():
fps_overlay = fps_font.render(str(FPS), True, Color.Goldenrod)
window.blit(fps_overlay, (0,0))

def create_window():
global window, window_height, window_width, window_title
window_width, window_height = 800, 600
window_title = "The Path"
window = pygame.display.set_mode((window_width, window_height), pygame.HWSURFACE|pygame.DOUBLEBUF)


def count_fps():
global cSec, cFrame, FPS

if cSec == time.strftime("%S"):
cFrame += 1
else:
FPS = cFrame
cFrame = 0
cSec = time.strftime("%S")


create_window()

isRunning = True

while isRunning:
for event in pygame.event.get():
if event.type == pygame.QUIT:
isRunning = False

# Logic
count_fps()



# Render Graphics
window.blit(Sky)


# Render Simple Terrain Grid
for x in range(0, 640, tile_size):
for y in range(0, 480, tile_size):
window.blit(Tiles.Grass, (x, y))


show_fps()



pygame.display.update()


pygame.quit()
sys.exit
Reply
#2
blit takes 2 arguments, the first being the image and the second being the location. (x,y) or rect

next time please use a proper title, not HELP. Also post in the correct forum.
Recommended Tutorials:
Reply
#3
Thank you and sorry
Reply
#4
and use code tags
Recommended Tutorials:
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  [PyGame] pygame blit() method syafiq14 1 4,833 Oct-30-2020, 04:46 PM
Last Post: Russ_CW
  index error when using lists to blit rotated images codefun45 7 3,487 Sep-03-2020, 11:11 PM
Last Post: codefun45
  [PyGame] I found a way to generate sprites without .blit. Is it effecient? xBlackHeartx 19 8,230 Dec-07-2019, 01:06 PM
Last Post: metulburr
  moving image with blit rwahdan 2 2,979 Jul-10-2019, 06:24 PM
Last Post: nilamo

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020