Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
python2021
Code
ps_gui_example
Commits
90619c5d
Commit
90619c5d
authored
Apr 18, 2021
by
Fedrico Otaran
Browse files
Agrego nuevo tablero
parent
2d577f97
Pipeline
#243
failed with stages
in 0 seconds
Changes
3
Pipelines
1
Show whitespace changes
Inline
Side-by-side
src/component/board.py
0 → 100644
View file @
90619c5d
import
PySimpleGUI
as
sg
from
src.windows
import
board
def
start
():
window
=
loop
()
window
.
close
()
def
loop
():
window
=
board
.
build
(
"Fede"
,
"Milka"
)
while
True
:
event
,
_values
=
window
.
read
()
if
event
in
(
sg
.
WINDOW_CLOSED
,
"Exit"
,
"-exit-"
):
break
if
event
.
startswith
(
"cell"
):
_prefix
,
x
,
y
=
event
.
split
(
"-"
)
print
(
f
"Celda:
{
x
}
,
{
y
}
"
)
return
window
src/component/menu.py
View file @
90619c5d
import
PySimpleGUI
as
sg
from
src.windows
import
menu
from
src.component
import
board
def
start
():
...
...
@@ -17,12 +18,20 @@ def loop():
window
=
menu
.
build
()
while
True
:
event
,
values
=
window
.
read
()
event
,
_
values
=
window
.
read
()
if
event
in
(
sg
.
WINDOW_CLOSED
,
"Exit"
)
or
event
==
"-exit-"
:
if
event
in
(
sg
.
WINDOW_CLOSED
,
"Exit"
,
"-exit-"
)
:
break
print
(
event
)
print
(
values
)
if
event
==
"-play-"
:
window
.
hide
()
board
.
start
()
window
.
un_hide
()
if
event
==
"-settings-"
:
pass
if
event
==
"-score-"
:
pass
return
window
src/windows/board.py
0 → 100644
View file @
90619c5d
import
PySimpleGUI
as
sg
def
build
(
player1_name
,
player2_name
):
layout
=
[
[
sg
.
Text
(
'Jugador 1: '
+
player1_name
,
key
=
'-P1-'
,
text_color
=
'darkblue'
)],
[
sg
.
Text
(
'Jugador 2: '
+
player2_name
,
key
=
'-P2-'
,
text_color
=
'white'
)],
[
sg
.
Text
(
''
)]
]
for
y
in
range
(
3
):
layout
+=
[
[
sg
.
Button
(
' '
,
size
=
(
8
,
4
),
key
=
f
"cell-
{
x
}
-
{
y
}
"
)
for
x
in
range
(
3
)]
]
board
=
sg
.
Window
(
'Ta Te Ti'
).
Layout
(
layout
)
return
board
\ No newline at end of file
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment