File tree 1 file changed +71
-0
lines changed
1 file changed +71
-0
lines changed Original file line number Diff line number Diff line change
1
+
2
+ from tkinter import *
3
+ from tkcalendar import Calendar
4
+ import tkinter as tk
5
+
6
+
7
+ window = tk .Tk ()
8
+
9
+ # Adjust size
10
+ window .geometry ("600x500" )
11
+
12
+ gameList = ["Game List:" ]
13
+ # Change the label text
14
+ def show ():
15
+ game = selected1 .get () + " vs " + selected2 .get ()+ " on " + cal .get_date ()
16
+ gameList .append (game )
17
+ #print(gameList)
18
+ gameListshow = "\n " .join (gameList )
19
+ #print(gameList)
20
+ label .config (text = gameListshow )
21
+
22
+
23
+ # Dropdown menu options
24
+ options = [
25
+ "Team 1" ,
26
+ "Team 2" ,
27
+ "Team 3" ,
28
+ "Team 4" ,
29
+ "Team 5" ,
30
+ "Team 6"
31
+ ]
32
+
33
+ # datatype of menu text
34
+ selected1 = StringVar ()
35
+ selected2 = StringVar ()
36
+
37
+ # initial menu text
38
+ selected1 .set ("Team 1" )
39
+ selected2 .set ("Team 2" )
40
+
41
+ # Create Dropdown menu
42
+ L1 = Label (window , text = "Visitor" )
43
+ L1 .place (x = 40 , y = 35 )
44
+ drop1 = OptionMenu (window , selected1 , * options )
45
+ drop1 .place (x = 100 , y = 30 )
46
+
47
+ L2 = Label (window , text = "VS" )
48
+ L2 .place (x = 100 , y = 80 )
49
+
50
+ L3 = Label (window , text = "Home" )
51
+ L3 .place (x = 40 , y = 115 )
52
+ drop2 = OptionMenu (window , selected2 , * options )
53
+ drop2 .place (x = 100 , y = 110 )
54
+
55
+ # Add Calendar
56
+ cal = Calendar (window , selectmode = 'day' ,
57
+ year = 2022 , month = 12 ,
58
+ day = 1 )
59
+
60
+ cal .place (x = 300 , y = 20 )
61
+
62
+
63
+
64
+ # Create button, it will change label text
65
+ button = Button ( window , text = "Add to calender" , command = show ).place (x = 100 ,y = 200 )
66
+
67
+ # Create Label
68
+ label = Label (window , text = " " )
69
+ label .place (x = 150 , y = 250 )
70
+
71
+ window .mainloop ()
You can’t perform that action at this time.
0 commit comments