Exemple #1
0
from pggui import Window
from pggui.widgets import Entry
from pggui.utils import Vec2, Color, Font

import os

window = Window(Vec2(170, 260), debug=True)
file = os.path.join(os.path.dirname(__file__), "image.png")
window.add_widget(Entry(Vec2(10, 10)))
window.add_widget(Entry(Vec2(10, 60), 150))
window.add_widget(Entry(Vec2(10, 110),
                        font=Font(color=Color.from_name("RED"))))
window.add_widget(Entry(Vec2(10, 160), accepted="abc"))
window.add_widget(Entry(Vec2(10, 210), image=file))
window.run()
Exemple #2
0
from pggui import Window
from pggui.widgets import Polygon
from pggui.utils import Vec2, Color

window = Window(Vec2(200, 200), debug=True)
window.add_widget(Polygon((Vec2(30, 30), Vec2(30, 40), Vec2(40, 30))))
window.add_widget(
    Polygon((Vec2(40, 60), Vec2(60, 60), Vec2(60, 40)),
            Color.from_name("RED")))
window.add_widget(
    Polygon((Vec2(100, 60), Vec2(100, 100), Vec2(60, 100), Vec2(120, 154)),
            Color.from_name("RED"), 5))
window.run()
Exemple #3
0
from pggui import Window

window = Window(debug=True)
window.run()
Exemple #4
0
from pggui import Window
from pggui.widgets import ProgressBar
from pggui.utils import Vec2, Color, Font

from random import randint

window = Window(Vec2(220, 100), debug=True)
window.add_widget(ProgressBar(Vec2(10, 10)))
window.add_widget(ProgressBar(Vec2(10, 30), value=randint(10, 90)))
window.add_widget(
    ProgressBar(Vec2(10, 50), Vec2(200, 20), value=randint(10, 90)))
window.add_widget(
    ProgressBar(Vec2(10, 80),
                color=Color.from_name("RED"),
                value=randint(10, 90)))
window.run()
Exemple #5
0
from pggui import Window
from pggui.widgets import Circle
from pggui.utils import Vec2, Color

window = Window(Vec2(200, 200), debug=True)
window.add_widget(Circle(Vec2(30, 30)))
window.add_widget(Circle(Vec2(80, 40), 30, Color.from_name("RED")))
window.add_widget(Circle(Vec2(30, 80), 20, Color.from_name("RED"), 3))
window.run()
Exemple #6
0
from pggui import Window
from pggui.utils import Keys

window = Window(debug=True)
window.set_key_callback(Keys.K_ESCAPE, window.stop)
window.run()
Exemple #7
0
from pggui import Window
from pggui.widgets import TextEdit
from pggui.utils import Vec2, Color, Font

import os

window = Window(Vec2(170, 510), debug=True)
file = os.path.join(os.path.dirname(__file__), "image.png")
window.add_widget(TextEdit(Vec2(10, 10)))
window.add_widget(TextEdit(Vec2(10, 120), Vec2(150, 50)))
window.add_widget(
    TextEdit(Vec2(10, 180), font=Font(color=Color.from_name("RED"))))
window.add_widget(TextEdit(Vec2(10, 290), accepted="abc"))
window.add_widget(TextEdit(Vec2(10, 400), image=file))
window.run()
Exemple #8
0
from pggui import Window
from pggui.widgets import Checkbox
from pggui.utils import Vec2, Color, Font

window = Window(Vec2(60, 150), debug=True)
window.add_widget(Checkbox(Vec2(10, 10), "Check 1"))
window.add_widget(Checkbox(Vec2(10, 40), "Check 2", font=Font(size=20)))
window.add_widget(Checkbox(Vec2(10, 70), "Check 3", checked=True))
window.add_widget(Checkbox(Vec2(10, 100), "Check 4", scale=2))
window.run()
from pggui import Window
from pggui.utils import Color, Vec2


window = Window(Vec2(550, 300), Color.from_name("WHITE"), "TESTING PGGUI", 50, debug = True)
window.run()
Exemple #10
0
from pggui import Window
from pggui.widgets import Label
from pggui.utils import Vec2, Color, Font

window = Window(Vec2(400, 400), debug=True)
window.add_widget(Label(Vec2(20, 30), "On y crois tous."))
window.add_widget(Label(Vec2(20, 50), "On y crois tous.", Font(size=20)))
window.add_widget(
    Label(Vec2(20, 80), "On y crois tous.", Font(size=20),
          Color.from_name("RED")))
window.add_widget(
    Label(Vec2(20, 110), "On y crois tous.\nOU PAS !", Font(size=20),
          Color.from_name("RED"), 0))
window.add_widget(
    Label(Vec2(20, 200), "On y crois pas tous.\nOU PAS PAS !", Font(size=20),
          Color.from_name("RED"), 10))
window.run()
Exemple #11
0
from pggui import Window
from pggui.widgets import Line
from pggui.utils import Vec2, Color

window = Window(Vec2(200, 200), debug=True)
window.add_widget(
    Line(Vec2(10, 10), Vec2(120, 180), color=Color.from_name("WHITE")))
window.add_widget(
    Line(Vec2(10, 10), Vec2(2, 124), color=Color.from_name("ORANGE")))
window.add_widget(
    Line(Vec2(150, 32), Vec2(15, 184), 10, Color.from_name("RED")))
window.run()
Exemple #12
0
from pggui import Window
from pggui.widgets import Rect
from pggui.utils import Vec2, Color

window = Window(Vec2(200, 200), debug=True)
window.add_widget(Rect(Vec2(10, 10), Vec2(120, 180), Color.from_name("WHITE")))
window.add_widget(Rect(Vec2(10, 10), Vec2(20, 124), Color.from_name("ORANGE")))
window.add_widget(Rect(Vec2(100, 32), Vec2(50, 100), Color.from_name("RED")))
window.add_widget(Rect(Vec2(20, 10), Vec2(50, 100), Color.from_name("RED"), 5))
window.run()
Exemple #13
0
from pggui import Window
from pggui.widgets import Button
from pggui.utils import Vec2, Color, Font

import os


def click():
    print("clicked")


window = Window(Vec2(230, 110), debug=True)
file = os.path.join(os.path.dirname(__file__), "image.png")
window.add_widget(Button(Vec2(10, 10), "Click 1", click))
window.add_widget(Button(Vec2(120, 10), "Click 2", click, Font(size=20)))
window.add_widget(
    Button(Vec2(10, 60), "Click 3", click, background=Color.from_name("RED")))
window.add_widget(Button(Vec2(120, 60), "Click 4", click, background=file))
window.run()
Exemple #14
0
from pggui import Window
from pggui.widgets import Frame, Label
from pggui.utils import Vec2, Color

window = Window(Vec2(310, 410), debug=True)
frame1 = Frame(Vec2(10, 10))
frame1.add_widget(Label(Vec2(10, 10), "Ceci est un test"))
frame2 = Frame(Vec2(10, 200), Vec2(100, 200))
frame2.add_widget(Label(Vec2(10, 10), "Ceci est un test"))
frame3 = Frame(Vec2(200, 200), Vec2(100, 200), Color.from_name("RED"))
frame3.add_widget(Label(Vec2(10, 10), "Ceci est un test"))
window.add_widget(frame1)
window.add_widget(frame2)
window.add_widget(frame3)
window.run()
Exemple #15
0
from pggui import Window
from pggui.widgets import Image
from pggui.utils import Vec2, Color

import os

window = Window(Vec2(400, 400), debug=True)
file = os.path.join(os.path.dirname(__file__), "image.png")
window.add_widget(Image(Vec2(10, 10), file))
window.add_widget(Image(Vec2(250, 10), file, Vec2(100, 100), 127))
window.add_widget(Image(Vec2(10, 250), file, Vec2(100, 100), flipy=True))
window.add_widget(
    Image(Vec2(250, 250), file, Vec2(100, 100), flipx=True, flipy=True))
window.run()
Exemple #16
0
from pggui import Window
from pggui.widgets import Selector
from pggui.utils import Vec2, Color, Font


window = Window(Vec2(150, 140), debug=True)
window.add_widget(Selector(Vec2(10, 10), "Ceci est", "un test"))
window.add_widget(Selector(Vec2(10, 50), "Ceci est", "un test", font=Font(size=20)))
window.add_widget(Selector(Vec2(10, 100), "Ceci est", "un test", color=Color.from_name("RED")))
window.run()