Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
S
se3xa3
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Hameed Andy
se3xa3
Commits
0758ab20
Commit
0758ab20
authored
6 years ago
by
Hameed Andy
Browse files
Options
Downloads
Patches
Plain Diff
GUI Library
parent
df1cbedd
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
BlankProjectTemplate/src/GUI.py
+42
-0
42 additions, 0 deletions
BlankProjectTemplate/src/GUI.py
with
42 additions
and
0 deletions
BlankProjectTemplate/src/GUI.py
0 → 100644
+
42
−
0
View file @
0758ab20
## @file GUI.py
# @Author Vaibhav Chadha | Andy Hameed
# @brief A library for common functions used for displaying text and buttons
# @details Used in modules that display text and buttons
# @date 11/09/2018
import
pygame
,
sys
## @brief A method to create a button
# @details This method will make a box on the interface
# @param surface The background (surface) the box should be made on
# @param color The color of the button to be made
# @param Rect The coordinate of the button with the length and width
# @param width The width of the sides of button
def
button
(
Surface
,
color
,
Rect
,
width
):
pygame
.
draw
.
rect
(
Surface
,
color
,
Rect
,
width
)
## @brief A method to display text
# @details This function will print the text on the interface
# @param text The text to be printed
# @param fontStyle The font Style of the text to be displayed
# @param fontSize The size of the text written
# @param color The color of the text
# @param coord The coordinate at which the text should start displaying
# @param surface The background (surface) the text should be printed on
def
text
(
text
,
fontStyle
,
fontSize
,
color
,
coord
,
surface
):
font
=
pygame
.
font
.
SysFont
(
fontStyle
,
fontSize
)
text
=
font
.
render
(
text
,
True
,
color
)
surface
.
blit
(
text
,
coord
)
## @brief A method to display downloaded text using .ttf files
# @details This function will print the text on the interface
# @param text The text to be printed
# @param fontName The name of the font/ttf file
# @param fontSize The size of the text written
# @param color The color of the text
# @param coord The coordinate at which the text should start displaying
# @param surface The background (surface) the text should be printed on
def
custom_text
(
text
,
fontName
,
fontSize
,
color
,
coord
,
surface
):
font
=
pygame
.
font
.
Font
(
fontName
,
fontSize
)
text
=
font
.
render
(
text
,
True
,
color
)
surface
.
blit
(
text
,
coord
)
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment