forked from pythonarcade/arcade
-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
6 changed files
with
98 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,63 @@ | ||
import arcade | ||
|
||
import arcade.gui | ||
from arcade.gui import UIFlatButton, UIGhostFlatButton, UIManager | ||
from arcade.gui.ui_style import UIStyle | ||
|
||
class MyView(arcade.View): | ||
def __init__(self, window: arcade.Window): | ||
super().__init__() | ||
|
||
self.window = window | ||
self.ui_manager = UIManager(window) | ||
|
||
def on_draw(self): | ||
arcade.start_render() | ||
arcade.set_background_color(arcade.color.BLACK) | ||
|
||
def on_show(self): | ||
self.setup() | ||
|
||
def setup(self): | ||
self.ui_manager.purge_ui_elements() | ||
flat = UIFlatButton('Hello world', center_x=200, center_y=self.window.height // 2, width=200, height=40) | ||
flat.set_style_attrs( | ||
font_color=arcade.color.WHITE, | ||
font_color_hover=arcade.color.WHITE, | ||
font_color_press=arcade.color.WHITE, | ||
bg_color=(51, 139, 57), | ||
bg_color_hover=(51, 139, 57), | ||
bg_color_press=(28, 71, 32), | ||
border_color=(51, 139, 57), | ||
border_color_hover=arcade.color.WHITE, | ||
border_color_press=arcade.color.WHITE | ||
) | ||
self.ui_manager.add_ui_element(flat) | ||
|
||
# creates a new class, which will match the id | ||
UIStyle.default_style().set_class_attrs( | ||
'right_button', | ||
font_color=arcade.color.WHITE, | ||
font_color_hover=arcade.color.WHITE, | ||
font_color_press=arcade.color.WHITE, | ||
bg_color=(135, 21, 25), | ||
bg_color_hover=(135, 21, 25), | ||
bg_color_press=(122, 21, 24), | ||
border_color=(135, 21, 25), | ||
border_color_hover=arcade.color.WHITE, | ||
border_color_press=arcade.color.WHITE | ||
) | ||
self.ui_manager.add_ui_element(UIGhostFlatButton( | ||
'Hello world', | ||
center_x=600, | ||
center_y=self.window.height // 2, | ||
width=200, | ||
height=40, | ||
id='right_button' | ||
)) | ||
|
||
|
||
if __name__ == '__main__': | ||
window = arcade.Window(title='ARCADE_GUI') | ||
window.show_view(MyView(window)) | ||
arcade.run() |
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
:orphan: | ||
|
||
.. _gui_custom_style: | ||
|
||
GUI Custom Style | ||
================ | ||
|
||
.. note:: | ||
|
||
This example requires Arcade 2.4a10 or higher. | ||
|
||
.. image:: gui_custom_style.png | ||
:width: 600px | ||
:align: center | ||
:alt: GUI Custom Style | ||
|
||
.. literalinclude:: ../../arcade/examples/gui_custom_style.py | ||
:caption: gui_custom_style.py | ||
:linenos: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
Social Media | ||
============ | ||
|
||
* `Discord <https://discord.gg/ZjGDqMp>`_ - The most active spot | ||
* `Reddit /r/pythonarcade <https://www.reddit.com/r/pythonarcade/>`_ The next most active spot | ||
* `Twitter @ArcadeLibrary <https://twitter.com/ArcadeLibrary>`_ Good for announcements | ||
* `Instagram @PythonArcadeLibrary <https://www.instagram.com/PythonArcadeLibrary/>`_ | ||
* `Facebook <https://www.facebook.com/ArcadeLibrary/>`_ |