forked from geekcomputers/Python
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
6c3bf08
commit 745af1f
Showing
1 changed file
with
71 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,71 @@ | ||
|
||
from tkinter import * | ||
from tkcalendar import Calendar | ||
import tkinter as tk | ||
|
||
|
||
window = tk.Tk() | ||
|
||
# Adjust size | ||
window.geometry("600x500") | ||
|
||
gameList =["Game List:"] | ||
# Change the label text | ||
def show(): | ||
game = selected1.get() + " vs " + selected2.get()+" on "+cal.get_date() | ||
gameList.append(game) | ||
#print(gameList) | ||
gameListshow = "\n".join(gameList) | ||
#print(gameList) | ||
label.config(text=gameListshow) | ||
|
||
|
||
# Dropdown menu options | ||
options = [ | ||
"Team 1", | ||
"Team 2", | ||
"Team 3", | ||
"Team 4", | ||
"Team 5", | ||
"Team 6" | ||
] | ||
|
||
# datatype of menu text | ||
selected1 = StringVar() | ||
selected2 = StringVar() | ||
|
||
# initial menu text | ||
selected1.set("Team 1") | ||
selected2.set("Team 2") | ||
|
||
# Create Dropdown menu | ||
L1 = Label(window, text="Visitor") | ||
L1.place(x=40, y=35) | ||
drop1 = OptionMenu(window, selected1, *options) | ||
drop1.place(x=100, y=30) | ||
|
||
L2 = Label(window, text="VS") | ||
L2.place(x=100, y=80) | ||
|
||
L3 = Label(window, text="Home") | ||
L3.place(x=40, y=115) | ||
drop2 = OptionMenu(window, selected2, *options) | ||
drop2.place(x=100, y=110) | ||
|
||
# Add Calendar | ||
cal = Calendar(window, selectmode='day', | ||
year=2022, month=12, | ||
day=1) | ||
|
||
cal.place(x=300, y=20) | ||
|
||
|
||
|
||
# Create button, it will change label text | ||
button = Button( window, text="Add to calender", command=show).place(x=100,y=200) | ||
|
||
# Create Label | ||
label = Label(window, text=" ") | ||
label.place(x=150, y=250) | ||
|
||
window.mainloop() |