-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmain.py
87 lines (71 loc) · 2.64 KB
/
main.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
import flet as ft
from board import Board
from player import Player
from tiles import Tiles
from drag_controlls import DragControlls
from alert import Alert
def main(page: ft.Page):
page.title = "WordMe"
page.bgcolor="white"
#page.platform = ft.PagePlatform.ANDROID
if page.platform == ft.PagePlatform.LINUX or page.platform == ft.PagePlatform.MACOS or page.platform == ft.PagePlatform.WINDOWS:
page.window.width = 420
page.window.min_width = 420
page.window.padding = 0
page.window.margin = 0
alert=Alert(page)
tiles = Tiles()
bd = Board(page, tiles)
boardArray = bd.set_up_board()
board = boardArray[0]
boardRow = boardArray[1]
dc = DragControlls(page, board, tiles, bd)
p = Player(page, dc)
draggable_tiles = {}
player_name_row = p.set_up_player_names()
player = p.set_up_player()
#draggable_tiles = player["draggable_tiles"]
tile_row = player["tile_row"]
#print(draggable_tiles)
#isStartPosAvail = bd.check_pos_available(board)
def play_click(e):
wordsPlayed = tiles.play(board, alert)
print(wordsPlayed)
#print(isStartPosAvail)
# Layout all components in a column
page.floating_action_button = ft.FloatingActionButton(icon=ft.icons.PLAY_ARROW_ROUNDED, on_click=play_click,)
page.floating_action_button_location = ft.FloatingActionButtonLocation.CENTER_DOCKED
page.appbar = ft.AppBar(
title=player_name_row,
center_title=True,
bgcolor=ft.colors.LIGHT_BLUE_ACCENT,
automatically_imply_leading=False,
)
page.bottom_appbar = ft.BottomAppBar(
bgcolor=ft.colors.LIGHT_BLUE_ACCENT,
shape=ft.NotchShape.AUTO,
height=64,
content=ft.Row(
controls=[
ft.IconButton(icon=ft.icons.MENU, icon_color=ft.colors.WHITE),
ft.Container(expand=True),
ft.IconButton(icon=ft.icons.KEYBOARD_DOUBLE_ARROW_RIGHT_ROUNDED, icon_color=ft.colors.WHITE),
ft.Container(expand=True),
ft.IconButton(icon=ft.icons.SWAP_VERT_ROUNDED, icon_color=ft.colors.WHITE),
ft.Container(expand=True),
ft.IconButton(icon=ft.icons.SHUFFLE_ROUNDED, icon_color=ft.colors.WHITE),
]
),
)
page.add(
ft.Column(
controls=[
boardRow,
tile_row,
],
alignment=ft.MainAxisAlignment.CENTER,
horizontal_alignment=ft.CrossAxisAlignment.CENTER,
)
)
# Run the app
ft.app(target=main)