In this article we will see how we can get the directory for saving paths of user in PYGLET module in python. Pyglet is easy to use but powerful library for developing visually rich GUI applications like games, multimedia etc. 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). In order to load a file i.e resource we use resource module of pyglet. This module allows applications to specify a search path for resources. Relative paths are taken to be relative to the application’s __main__ module. Different platforms have different conventions for where to save user preferences, saved games, and settings. This function implements those conventions. Note that the returned path may not exist: applications should use os.makedirs to construct it if desired. On Linux, a directory name in the user’s configuration directory is returned (usually under ~/.config). On Windows (including under Cygwin) the name directory in the user’s Application Settings directory is returned.
We can create a window object with the help of command given below
# creating a window window = pyglet.window.Window(width, height, title)
In order to do this we use
get_settings_pathmethod with the pyglet.resource
Syntax : resource.get_settings_path(name)
Argument : It takes string as argument
Return : It returns string
Below is the implementation
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.
- PYGLET – Getting Program Entry Directory
- PYGLET – User Key
- Saving a Pandas Dataframe as a CSV
- Saving Text, JSON, and CSV to a File in Python
- Saving a Video using OpenCV
- ML - Saving a Deep Learning model in Keras
- MoviePy –Saving Video File Clip
- MoviePy – Saving a Frame of Video Clip
- MoviePy – Saving Video File as GIF
- PyCairo - Saving SVG Image file to PNG file
- Saving Operated Video from a webcam using OpenCV
- PYGLET – Getting System Mouse Cursor Object
- PYGLET – Getting Window Size
- PYGLET – Getting Window current Location
- PYGLET – Getting Window Width
- PYGLET – Getting Window Vsync Property
- PYGLET – Getting Window Visible Status
- PYGLET – Getting Window Style
- PYGLET – Getting Window Screen
- PYGLET – Getting Window Resizable Property
If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to firstname.lastname@example.org. See your article appearing on the GeeksforGeeks main page and help other Geeks.
Please Improve this article if you find anything incorrect by clicking on the "Improve Article" button below.