title: Resizing a video player
body: <p>I have pygame based video player, it has berkelium browser used for GUI,
  under that are VLC libraries for playing streams. I did not make the player, but I would
  like to add a "resize" option, which is not currently present.
  The application is made for OS X.</p>
  
  <p>On initialization of the player, <code>pygame.set_mode(screensize,OPENGL|DOUBLEBUF|RESIZABLE)</code> is called, problem is when I resize the window more than the screen size, these parts are not visible(shown bugged), if I try <code>pygame.set_mode</code> again, it causes the app to crash because of dependencies (browser and VLC).</p>
  
  <p>So I decided to initialize screen using:</p>
  
  <p><code>pygame.set_mode(screenresolution, OPENGL|DOUBLEBUF|RESIZABLE)</code> </p>
  
  <p>Which should set it to the max and then switch back to original, smaller resolution (like resize with the mouse). </p>
  
  <p>How to do that? how to simulate the <code>RESIZABLE</code> flag and mouse move action?</p>
  
  <p>The player works nice resizing to smaller sizes, it is only bigger sizes that are a problem.</p>
  
  <pre class="lang-py prettyprint-override"><code>class InputAndDisplay:
      def init(self, fullscreen=False):
          global pygame, sys
          # if 'darwin' in sys.platform:
          #     import sys
          #     sys.argv = ['Core.py']
          #     import pygame.macosx
          #     pygame.macosx.init()
  
          pygame.init()
  
          global screenSize
          self.screenSize = screenSize
          if fullscreen:
              try: self.screenSize = pygame.display.list_modes()[0]
              except Exception, e: print e
              flags = OPENGL|DOUBLEBUF|FULLSCREEN
          else:
              flags = RESIZABLE|OPENGL|DOUBLEBUF
  
          print 'screenSize:', self.screenSize
  
          try:
              povrsina = pygame.display.set_mode(self.screenSize, flags)
          except Exception, e:
              print e
              self.screenSize = screenSize
              povrsina = pygame.display.set_mode(self.screenSize, RESIZABLE|OPENGL|DOUBLEBUF)
          pygame.display.set_caption('NetTVBox-WebPlayer')
  
          pygame.mouse.set_pos(list(self.screenSize))
          if 'darwin' not in sys.platform:
              pygame.mouse.set_visible(False)
  
          #pygame.key.set_repeat(300, 100)
  
          if 'darwin' not in sys.platform:
              pygame.mixer.quit()
  
          if 'linux' in sys.platform: # try to turn off vsyncing
              import ctypes
              libgl = ctypes.cdll.LoadLibrary('libGL.so.1')
              proc = libgl.glXGetProcAddressARB('glXSwapIntervalMESA')
              _glXSwapIntervalMESA = ctypes.CFUNCTYPE(ctypes.c_int, ctypes.c_int)(proc)
              _glXSwapIntervalMESA(0)
  
          glMatrixMode(GL_PROJECTION)
          glLoadIdentity()
          #gluPerspective(45.0, 640/480.0, 0.1, 100.0)
          glOrtho(-0.5, 0.5, -0.5, 0.5, -5, 5)
          #glTranslatef(0.0, 0.0, -3.0)
          #glRotatef(25, 1, 0, 0)
  
          glMatrixMode(GL_MODELVIEW)
          glLoadIdentity()
  
          glEnable(GL_TEXTURE_2D)
          glShadeModel(GL_FLAT)
          glClearColor(0.0, 0.0, 0.0, 0.0)
          glClearDepth(1.0)
          glEnable(GL_DEPTH_TEST)
          glDepthFunc(GL_LEQUAL)
          glHint(GL_PERSPECTIVE_CORRECTION_HINT, GL_NICEST)
  
          self.textures = glGenTextures(2)
  
          self.threeDmode = MODE_3D_OFF
  </code></pre>
  
  <p>that's <code>init</code> in <code>inputAndDisplay.py</code><br>
  And main file is <code>Core.py</code> which calls it, and a lot of other stuff as well. Thats why I didnt put all the code here, there is a lot of it and not all important<br>
  Here is part of <code>Core.py</code>:</p>
  
  <pre class="lang-py prettyprint-override"><code>input_and_display = InputAndDisplay()
  input_and_display.init(self.fullscreen)
  rc = RemoteControl()
  rc.init()
  media = Media()
  if 1: # !
      media.config = {
          'buffering': state.mediaplayer_buffering,
          'contrast': state.mediaplayer_contrast,
          'saturation': state.mediaplayer_saturation,
      }
  media.init()
  browser = Browser()
  browser.init()
  </code></pre>
  
  <p>Thanks in advance for the help</p>