Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- # This Python code is a demo of the GUI guizero (with PushButton trigger)
- # guizero works with tkinter but simpler with extra widgets eg. Slider
- # https://lawsie.github.io/guizero/slider/
- # passTwice.py
- # Test if text fields match.
- # Import the GUI widgets that you'll be using, and create the 'app' for your program.
- from guizero import App, TextBox, PushButton, Text, info
- app = App( title="Password checker", bg = "#FFFF00", height = 400, width = 600 )
- #-------------------------------------
- # Function definitions for your events go here.
- def btn_go_clicked():
- if (txt_pwA.value == ""):
- info("Password","Password field is empty")
- else:
- if (txt_pwA.value == txt_pwB.value):
- info("Password","Passwords match OK")
- else:
- info("Password","Passwords DO NOT MATCH")
- #-----------------
- # Your GUI widgets go here
- h1 = Text(app, text="Password checker")
- h2_A = Text(app, text="Please enter your chosen password ..")
- txt_pwA = TextBox(app)
- h2_B = Text(app, text="Please re-enter your password ..")
- txt_pwB = TextBox(app)
- btn_go = PushButton(app, command=btn_go_clicked, text="Test for text match ..", padx=8,pady=7)
- # change parameters of widgets
- # -- adjust --
- h1.text_size = 30
- h1.text_color = "#56789A"
- btn_go.bg="#33FF55"
- #----------
- app.display() # Show the GUI on the screen
Add Comment
Please, Sign In to add comment