-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathgameSettings_support.py
111 lines (88 loc) · 2.74 KB
/
gameSettings_support.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
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
#! /usr/bin/env python
# -*- coding: utf-8 -*-
#
# Support module generated by PAGE version 4.22
# in conjunction with Tcl version 8.6
# Jul 22, 2019 09:25:45 PM CEST platform: Windows NT
# Jul 22, 2019 10:11:39 PM CEST platform: Windows NT
# Jul 23, 2019 10:10:36 AM CEST platform: Windows NT
# Jul 23, 2019 10:12:46 AM CEST platform: Windows NT
# Jul 23, 2019 10:13:15 AM CEST platform: Windows NT
# Jul 23, 2019 11:51:08 AM CEST platform: Windows NT
import sys
try:
import Tkinter as tk
except ImportError:
import tkinter as tk
try:
import ttk
py3 = False
except ImportError:
import tkinter.ttk as ttk
py3 = True
def set_Tk_var():
global varGroupField
varGroupField = tk.StringVar()
global varGroupSize
varGroupSize = tk.StringVar()
global varGroupDifficultyAI1
varGroupDifficultyAI1 = tk.StringVar()
global varGroupPlayer1
varGroupPlayer1 = tk.StringVar()
global varGroupDifficultyAI2
varGroupDifficultyAI2 = tk.StringVar()
global varGroupPlayer2
varGroupPlayer2 = tk.StringVar()
def btnSave_OnClick(p1):
w.fcnSetGameProperties(field = varGroupField.get(),
size = varGroupSize.get(),
player1Type = varGroupPlayer1.get(),
AI1difficulty = varGroupDifficultyAI1.get(),
player2Type = varGroupPlayer2.get(),
AI2difficulty = varGroupDifficultyAI2.get())
destroy_window()
def btnCancel_OnClick(p1):
destroy_window()
def rdbPlayer1_OnClick():
enableOrDisabledifficulty_AI1()
def rdbPlayer2_OnClick():
enableOrDisabledifficulty_AI2()
def enable(controlList):
for control in controlList:
control.configure(state='normal')
def disable(controlList):
for control in controlList:
control.configure(state='disable')
def enableOrDisabledifficulty_AI1():
if varGroupPlayer1.get()=='human':
disable(w.framePlayer1_AIdifficulty.winfo_children())
else:
enable(w.framePlayer1_AIdifficulty.winfo_children())
def enableOrDisabledifficulty_AI2():
if varGroupPlayer2.get()=='human':
disable(w.framePlayer2_AIdifficulty.winfo_children())
else:
enable(w.framePlayer2_AIdifficulty.winfo_children())
def init(top, gui, *args, **kwargs):
global w, top_level, root
w = gui
top_level = top
root = top
prop = kwargs['gameProperties']
w.fcnSetGameProperties = kwargs['fcnSetGameProperties']
varGroupField.set(prop['field'])
varGroupSize.set(prop['size'])
varGroupPlayer1.set(prop['player1Type'])
varGroupPlayer2.set(prop['player2Type'])
varGroupDifficultyAI1.set(prop['AI1difficulty'])
varGroupDifficultyAI2.set(prop['AI2difficulty'])
enableOrDisabledifficulty_AI1()
enableOrDisabledifficulty_AI2()
def destroy_window():
# Function which closes the window.
global top_level
top_level.destroy()
top_level = None
if __name__ == '__main__':
import gameSettings
gameSettings.vp_start_gui()