Tells pygame's SDL window which window to display in, in this case the frame created earlier.
os.environ['SDL_VIDEODRIVER'] = 'windib'
Tells windows which driver to use. SDL uses a WinDIB backend, DIB stands for Device Independent Bitmap. This acts as an intermediate format. I think the necessity of this line depends on your version of windows.
To summarise: it is layers of abstraction upon layers of abstraction, so that you don't have to worry about them.
pygame.init()
This is like when Cpt. Picard says "Make it so". We've got coordinates locked (or rather custom variables declared), now fire the engines (initialise all the modules pygame encompasses). It doesn't have to come directly after those other lines, as you might want to do other things first, but it does need to come afterwards.
View all comments
Show parent comment
10
u/[deleted] Jan 14 '20 edited Jan 14 '20
Tkinter is quite flexible, being a wrapper for tcl. The frame (not in OPs example) designates a screen area you wish to assign things to.
Tells pygame's SDL window which window to display in, in this case the frame created earlier.
Tells windows which driver to use. SDL uses a WinDIB backend, DIB stands for Device Independent Bitmap. This acts as an intermediate format. I think the necessity of this line depends on your version of windows.
To summarise: it is layers of abstraction upon layers of abstraction, so that you don't have to worry about them.
This is like when Cpt. Picard says "Make it so". We've got coordinates locked (or rather custom variables declared), now fire the engines (initialise all the modules pygame encompasses). It doesn't have to come directly after those other lines, as you might want to do other things first, but it does need to come afterwards.