Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- # BS_TicTacToe_01.py
- # Source: Martin O’Hanlon: 3.5 Grid layouts
- # - https://www.futurelearn.com/courses/programming-with-guis
- from guizero import App, Box, PushButton, Text
- app = App(title="BS_TicTacToe_01.py", width=900, height=500)
- # Event handlers -------------------------------------------------------------------------
- # Create widgets -------------------------------------------------------------------------
- box = Box(app, layout="grid", width=400, height=400)
- button1 = PushButton(box, text="X", grid=[0,0]) # Row 1: top
- button2 = PushButton(box, text=" O", grid=[1,0])
- button3 = PushButton(box, text=" ", grid=[2,0])
- button4 = PushButton(box, text=" ", grid=[0,1]) # Row 2: middle
- button5 = PushButton(box, text=" ", grid=[1,1])
- button6 = PushButton(box, text=" ", grid=[2,1])
- button7 = PushButton(box, text=" ", grid=[0,2]) # Row 3: bottom
- button8 = PushButton(box, text=" ", grid=[1,2])
- button9 = PushButton(box, text=" ", grid=[2,2])
- # Set properties -------------------------------------------------------------------------
- box.text_size = 30
- # Run ------------------------------------------------------------------------------------
- app.display()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement