mirror of
https://github.com/dcs-liberation/dcs_liberation.git
synced 2025-11-10 14:22:26 +00:00
new game ui; random weather and time
This commit is contained in:
41
ui/newgamemenu.py
Normal file
41
ui/newgamemenu.py
Normal 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)
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user