new game ui; random weather and time

This commit is contained in:
Vasyl Horbachenko
2018-06-13 23:36:57 +03:00
parent 1c67a2e4cf
commit 8a783625ce
8 changed files with 104 additions and 11 deletions

41
ui/newgamemenu.py Normal file
View File

@@ -0,0 +1,41 @@
from tkinter import *
from tkinter.ttk import *
from ui.window import *
class NewGameMenu(Menu):
selected_country = None # type: IntVar
def __init__(self, window: Window, callback: typing.Callable):
super(NewGameMenu, self).__init__(window, None, None)
self.frame = window.right_pane
self.callback = callback
self.selected_country = IntVar()
self.selected_country.set(0)
@property
def player_country_name(self):
if self.selected_country.get() == 0:
return "USA"
else:
return "Russia"
@property
def enemy_country_name(self):
if self.selected_country.get() == 1:
return "USA"
else:
return "Russia"
def display(self):
self.window.clear_right_pane()
Label(self.frame, text="Player country").grid(row=0, column=0)
Radiobutton(self.frame, text="USA", variable=self.selected_country, value=0).grid(row=1, column=0)
Radiobutton(self.frame, text="Russia", variable=self.selected_country, value=1).grid(row=2, column=0)
Button(self.frame, text="Proceed", command=self.proceed).grid(row=3, column=0)
def proceed(self):
self.callback(self.player_country_name, self.enemy_country_name)

View File

@@ -44,6 +44,7 @@ class Window:
class Menu:
parent = None # type: Menu
def __init__(self, window: Window, parent, game: Game):
self.window = window
self.parent = parent