Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- from guizero import Box, App, PushButton, TextBox, Text, info
- import random
- def act0():
- info("Clicked Button","Button Clicked")
- def act1():
- tx_head.value = "What is a GUI?"
- tx_body1.value = "A Graphical User Interface (GUI) usually"
- tx_body2.value = "includes four main features:"
- tx_body3.value = ""
- tx_body4.value = "* Windows"
- tx_body5.value = "* Icons"
- tx_body6.value = "* Menus and"
- tx_body7.value = "* Pointers"
- def act2():
- tx_head.value = "Advantages"
- tx_body1.value = "One advantage of a GUI is that users"
- tx_body2.value = "don\'t need to learn a language and"
- tx_body3.value = "its syntax."
- tx_body4.value = ""
- tx_body5.value = "For a user who cannot type quickly,"
- tx_body6.value = "it is easier to point, click and drag"
- tx_body7.value = "to complete common functions."
- def act3():
- tx_head.value = "Disadvantages"
- tx_body1.value = "A GUI needs far more resources"
- tx_body2.value = "compared to a Command Line"
- tx_body3.value = "Interface."
- tx_body4.value = ""
- tx_body5.value = "Older, slower systems may not"
- tx_body6.value = "be able to run a modern GUI"
- tx_body7.value = "efficiently."
- def act4():
- tx_head.value = "GUI Controls"
- tx_body1.value = "Many programming languages have"
- tx_body2.value = "libraries of commonly used controls. "
- tx_body3.value = ""
- tx_body4.value = "A widely tested and flexible set"
- tx_body5.value = "of tools saves huge amounts of time"
- tx_body6.value = "and effort for busy developers."
- tx_body7.value = ""
- def act5():
- tx_head.value = "Common Widgets"
- tx_body1.value = "Fequently used GUI controls include:"
- tx_body2.value = ""
- tx_body3.value = "* Buttons and Toggles"
- tx_body4.value = "* Text boxes and Labels"
- tx_body5.value = "* Check boxes and Radio buttons"
- tx_body6.value = "* Sliders"
- tx_body7.value = "* Combo boxes"
- app = App(width=640, height=480, layout="grid", title="Five Points!")
- title = Box(app, width=640, height=40, grid=[0,0,2,1])
- canvas = Box(app, width=560, height=400, grid=[0,1])
- buttons = Box(app, width=80, height=400, grid=[1,1])
- footer = Box(app, width=640, height=40, grid=[0,2,2,1])
- title.bg=(0,0,0)
- canvas.bg=(204,204,204)
- buttons.bg=(153,0,0)
- footer.bg=(0,0,0)
- buttons.text_color=(204,204,204)
- bt_nav1 = PushButton(buttons,text="1", width="fill", height="fill", command=act1)
- bt_nav2 = PushButton(buttons,text="2", width="fill", height="fill", command=act2)
- bt_nav3 = PushButton(buttons,text="3", width="fill", height="fill", command=act3)
- bt_nav4 = PushButton(buttons,text="4", width="fill", height="fill", command=act4)
- bt_nav5 = PushButton(buttons,text="5", width="fill", height="fill", command=act5)
- #bt_nav6 = PushButton(buttons,text="6", command=act0)
- #bt_nav7 = PushButton(buttons,text="7", command=act0)
- #bt_nav8 = PushButton(buttons,text="8", command=act0)
- #bt_nav9 = PushButton(buttons,text="9", command=act0)
- tx_head = Text(canvas, color=(0,0,102), size=36, text="Five Points")
- tx_body1 = Text(canvas, color=(0,0,51),size=20, align="top", text="")
- tx_body2 = Text(canvas, color=(0,0,51),size=20, align="top", text="")
- tx_body3 = Text(canvas, color=(0,0,51),size=20, align="top", text="Click on any of the")
- tx_body4 = Text(canvas, color=(0,0,51),size=20, align="top", text="five numbered buttons")
- tx_body5 = Text(canvas, color=(0,0,51),size=20, align="top", text="on the right to learn about")
- tx_body6 = Text(canvas, color=(0,0,51),size=20, align="top", text="GUI controls")
- tx_body7 = Text(canvas, color=(0,0,51),size=20, align="top", text="")
- app.display()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement