Use the tutorials under General Tutorials and Pygame Tutorials on Specific Topics on https://www.pygame.org/wiki/tutorials (if you're using Pygame on a computer, like Python for Windows/Mac/etc.)... they may be able to help you.
Currently, OnlineGDB doesn't support graphics (so Java Swing, or Pygame/Tkinter/Turtle/Karel, etc.), it only has an online HTML viewer, and Output/Input terminal/console.
:)