[pyar] python/pygame

Cristian Ariel Baez haztulojusto en gmail.com
Mie Nov 11 00:20:55 ART 2015


muchas gracias servira de mucho

El 11 de noviembre de 2015, 0:09, Ricardo Daniel Quiroga <
l2radamanthys en gmail.com> escribió:

> Mmmm es bastante sencillo, igual el ejemplo no esta completo, se come los
> saltos de linea pero como ejemplo sirve a modo ejemplo...
>
> import pygame
>
> WIDTH = 640
> HEIGHT = 480
> SCREEN_SIZE = (WIDTH, HEIGHT)
> BLANCO = (255,255,255)
> NEGRO = (0,0,0)
>
> def main():
>     pygame.init()
>     screen = pygame.display.set_mode(SCREEN_SIZE)
>     screen.fill(BLANCO)
>     clock = pygame.time.Clock()
>
>     text = open("lorem.txt", "r").read()
>     size = len(text)
>
>     ch = 0 #alto caracter
>     cw = 0 #ancho caracter
>
>     font_ = pygame.font.SysFont('opensans', 12)
>     cw, ch = font_.size("L") #no es exacto pero a modo ejemplo
>     nchar = (WIDTH-20) // cw + 1 # el menos 20 es porque dejare un margen
> de 10px
>     print(nchar)
>
>     idx = 0
>     x = 10
>     y = 10
>
>     while idx < size:
>         sub_text = text[idx:idx+nchar]
>         stext = font_.render(sub_text, True, NEGRO, screen)
>         screen.blit(stext, (x, y))
>         idx += nchar
>         y += ch
>
>     run = True
>     while run:
>         for event in pygame.event.get():
>             if event.type == pygame.QUIT:
>                 run = False
>
>
>         pygame.display.update()
>         clock.tick(60)
>
>     pygame.quit()
>
>
> if __name__ == "__main__":
>     main()
>
>
> El 10 de noviembre de 2015, 22:07, Cristian Ariel Baez <
> haztulojusto en gmail.com> escribió:
>
>> si
>>
>> El 10 de noviembre de 2015, 20:47, Ricardo Daniel Quiroga <
>> l2radamanthys en gmail.com> escribió:
>>
>>> Ósea queres dibujar un texto cualquiera en pantalla con pygame?
>>> ------------------------------
>>> De: Cristian Ariel Baez
>>> Enviado: 10/11/2015 17:16
>>> Para: Python Argentina
>>> Asunto: [pyar] python/pygame
>>>
>>> Quisiera saver si me pudieran pasar un ejemplo sensillo de como
>>> importaria en forma eleatoria una lista de string creada en el block de
>>> notas para que se vea en pygame. Desde ya se los agradeseria
>>>
>>> _______________________________________________
>>> pyar mailing list pyar en python.org.ar
>>> http://listas.python.org.ar/listinfo/pyar
>>>
>>> PyAr - Python Argentina - Sitio web: http://www.python.org.ar/
>>>
>>> La lista de PyAr esta Hosteada en USLA - Usuarios de Software Libre de
>>> Argentina - http://www.usla.org.ar
>>>
>>
>>
>> _______________________________________________
>> pyar mailing list pyar en python.org.ar
>> http://listas.python.org.ar/listinfo/pyar
>>
>> PyAr - Python Argentina - Sitio web: http://www.python.org.ar/
>>
>> La lista de PyAr esta Hosteada en USLA - Usuarios de Software Libre de
>> Argentina - http://www.usla.org.ar
>>
>
>
>
> --
>
> Ricardo Daniel Quiroga
>
>
> _______________________________________________
> pyar mailing list pyar en python.org.ar
> http://listas.python.org.ar/listinfo/pyar
>
> PyAr - Python Argentina - Sitio web: http://www.python.org.ar/
>
> La lista de PyAr esta Hosteada en USLA - Usuarios de Software Libre de
> Argentina - http://www.usla.org.ar
>
------------ próxima parte ------------
Se ha borrado un adjunto en formato HTML...
URL: <http://listas.python.org.ar/pipermail/pyar/attachments/20151111/a8cbcaa9/attachment.html>


More information about the pyar mailing list