PYGLET – Creating window
In this article we will see how we can create a window in PYGLET module in python. Pyglet is easy to use but powerful library for developing visually rich GUI applications like games, multimedia etc on Windows, Mac OS and Linux. This library is created purely in Python and it supports many features like windowing, user interface event handling, Joysticks, OpenGL graphics, loading images, and videos, and playing sounds and music. A window is a “heavyweight” object occupying operating system resources. Windows may appear as floating regions or can be set to fill an entire screen (fullscreen). When floating, windows may appear borderless or decorated with a platform-specific frame (including, for example, the title bar, minimize and close buttons, resize handles, and so on).
In order to create window we use Window method with the pyglet.window
Syntax : pyglet.window.Window(width, height, title)
Argument : It takes optional arguments i.e width, height and title of window
Return : It returns pyglet.window.win32.Win32Window object
Note : Either we provide no argument or we have to prove all three arguments else error would generate
Another Example :
Attention geek! Strengthen your foundations with the Python Programming Foundation Course and learn the basics.
To begin with, your interview preparations Enhance your Data Structures concepts with the Python DS Course. And to begin with your Machine Learning Journey, join the Machine Learning – Basic Level Course