pyopengl hangs

this the code in python since im using pyopengl. when i run it simpky hangs and only the top bar is visible. Other programs are working fine, which means there is no problem with the library and OS. Here is the code

try:
  from OpenGL.GLUT import *
  from OpenGL.GL import *
  from OpenGL.GLU import *
  
except: print '''ERROR: PyOpenGL not installed properly.'''

import sys

def init():
    glEnable(GL_TEXTURE_2D)
    glClearColor(0.0, 0.0, 0.0, 0.0)	
    glClearDepth(1.0)			
    glDepthFunc(GL_LESS)			
    glEnable(GL_DEPTH_TEST)			
    glShadeModel(GL_SMOOTH)			
    glMatrixMode(GL_PROJECTION)
    glClear(GL_COLOR_BUFFER_BIT)
    glLoadIdentity()
    glColor3d(0,0,1)

	
			
def main():
  glutInit(sys.argv)
  glutInitDisplayMode(GLUT_DOUBLE | GLUT_RGB)
  glutInitWindowSize (640,480)
  glutInitWindowPosition (0,0)
  window=glutCreateWindow ("Solar")
  glutIdleFunc(mydisplay)  
  glutDisplayFunc(mydisplay)
  glutKeyboardFunc(mydisplay)
  glutKeyboardFunc(mydisplay)
  init()
  glutMainLoop()
  exit()

def mydisplay():
  glBegin(GL_POINTS)
  glVertex2i(10,20)
  glEnd()
 

main()
 



  glutIdleFunc(mydisplay)  
  glutKeyboardFunc(mydisplay)
  glutKeyboardFunc(mydisplay)

This is not good at all. You can have a look here for more details about how to use these functions here: http://www.opengl.org/documentation/specs/glut/spec3/spec3.html

thanks but the code works for

   glutInitDisplayMode(GLUT_SINGLE | GLUT_RGB)

instead of GLUT|DOUBLE
what could be the reason?

When using double buffer, you draw in the background buffer (so nothing is drawn on screen), and when swapping the buffer, what you drawn is displayed, and so on.

While on single buffer, you always draw on screen.

You really need to take into account what I said before too.