Note that there are some explanatory texts on larger screens.

plurals
  1. POfull drawing not displaying on screen pygame
    primarykey
    data
    text
    <p>I have the following python/pygame code:</p> <pre><code>import sys, pygame from array import * pygame.init() height = 600 width = 800 </code></pre> <p>Setup Display Window</p> <pre><code> DISPLAYSURFACE = pygame.display.set_mode((width, height)) pygame.display.set_caption('Graphics Assignment Part 1') </code></pre> <p>open file </p> <pre><code> file = open('F:\\school\\Graphics\\PIXA.DAT', 'r') </code></pre> <p>read file into a list and close it</p> <pre><code> vlist = file.readlines() #close file file.close #remove last value from list del vlist[-1] </code></pre> <p>store values from vlist into points but change J to JUMP bit and split ints with , </p> <pre><code> points = [list(map(int,v.split())) if v.strip().lower() != "j" else "JUMP" for v in vlist] </code></pre> <p>Setup loops to split vlist into 3 lists of x,y,z coordinate lists </p> <pre><code>Xs,Ys,Zs= zip(*points) unique_Xs = [] [unique_Xs.append(val) for val in Xs if val != "J"] unique_Ys = [] [unique_Ys.append(val) for val in Ys if val != "U"] unique_Zs = [] [unique_Zs.append(val) for val in Zs if val != "M"] draw = list(zip(unique_Xs,unique_Ys)) </code></pre> <p>Draw the list of points on the Screen as a series of lines</p> <pre><code> drawing = pygame.draw.lines(DISPLAYSURFACE,(0,255,172),False, draw, 1) </code></pre> <p>Update the Display and quit pygame</p> <pre><code> pygame.display.update() running = True while running: for event in pygame.event.get(): if event.type == pygame.QUIT: running = False </code></pre> <p>I am reading in a list of coordinates and storing them into a list of x,y,z coordinates to draw a set of lines in pygame.</p> <p>I can draw the image however the whole thing does not show up on the screen because the points are in the range of -2000 to 2000.</p> <p>How can i change my coordinate range in my python window to display my whole image in my 800x600 display window</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload