Ver Mensaje Individual
  #1 (permalink)  
Antiguo 21/01/2009, 12:40
Avatar de dmassive
dmassive
 
Fecha de Ingreso: febrero-2002
Ubicación: Paraná - Entre Ríos - Argentina
Mensajes: 279
Antigüedad: 22 años, 2 meses
Puntos: 7
Highlight Python para postear codigo en Python

Buenos días!

Hice este tema por aqui porque la verdad que no encontraba como colocar codigo python con sus sintaxis resaltada en colores, es decir no sabia que BBCODE usar. En los hilos marcados como importantes no aparecia nada tampoco y tuve que googlear un buen tiempo puesto que siempre use CODE /CODE para postear en los foros.


Asi que el codigo normal seria asi:
Código:
import pygame
from pygame.locals import *

clock = pygame.time.Clock()
speed = 250

while True:
    time_passed = clock.tick()
    time_passed_seconds = time_passed / 1000.0
    print "Milisegundos: ", time_passed
    print "Segundos: ", time_passed_seconds
    print "Pixeles: ", time_passed_seconds * speed
    print "1- Alta"
    print "2- Baja"
    print "3- Modificaciones"
    print "q- Salir"
    print
    opcion = raw_input("Ingrese opcion: ")
    if opcion.lower() == "q":
        exit()
Para resaltar sintaxis python hay que colocar (sin el asterisco *)
[*highlight=python]el codigo[/highlight]

Código python:
Ver original
  1. import pygame
  2. from pygame.locals import *
  3.  
  4. clock = pygame.time.Clock()
  5. speed = 250
  6.  
  7. while True:
  8.     time_passed = clock.tick()
  9.     time_passed_seconds = time_passed / 1000.0
  10.     print "Milisegundos: ", time_passed
  11.     print "Segundos: ", time_passed_seconds
  12.     print "Pixeles: ", time_passed_seconds * speed
  13.     print "1- Alta"
  14.     print "2- Baja"
  15.     print "3- Modificaciones"
  16.     print "q- Salir"
  17.     print
  18.     opcion = raw_input("Ingrese opcion: ")
  19.     if opcion.lower() == "q":
  20.         exit()
__________________
Blümchen... einfach die rave Prinzessin
http://www.dmassive.com.ar/