Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import tkinter as tk
- from tkinter import ttk
- from tkinter import messagebox as msg
- # Establishes the GUI
- win = tk.Tk()
- win.title('MFF:Worlds Launcher (Version 001.2B)')
- # Creating the labels
- a_label = ttk.Label(win, text='Username:')
- a_label.grid(column=0, row=0)
- b_label = ttk.Label(win, text="Password:")
- b_label.grid(column=1, row=0)
- c_label = ttk.Label(win, text='Select a Server:')
- c_label.grid(column=2, row=0)
- # Creating the Entries
- a_entry = ttk.Entry(win, width=12)
- a_entry.grid(column=0, row=1)
- a_entry.focus() # sets the focus on the first entry
- b_entry = ttk.Entry(win, width=12, show='*') # 'show' hides the plaintext
- b_entry.grid(column=1, row=1)
- # Creating the Combobox and its dependencies
- server = tk.StringVar()
- server_list = ttk.Combobox(win, width=14, textvariable=server, state='readonly') # 'readonly' makes it read only (duh)
- server_list['values'] = ('North America', 'Europe', 'Asia', 'Public Test')
- server_list.grid(column=2, row=1)
- server_list.current(0)
- # Creating three check buttons
- chVarDis = tk.IntVar()
- check1 = tk.Checkbutton(win, text='Error Reporting', variable=chVarDis, state='disabled')
- check1.select()
- check1.grid(column=0, row=4, sticky=tk.W)
- chVarUn = tk.IntVar()
- check2 = tk.Checkbutton(win, text='Safe Mode', variable=chVarUn)
- check2.deselect()
- check2.grid(column=1, row=4, sticky=tk.W)
- chVarEn = tk.IntVar()
- check3 = tk.Checkbutton(win, text='Fullscreen', variable=chVarEn)
- check3.select()
- check3.grid(column=2, row=4, sticky=tk.W)
- # Button command def
- def clicked():
- a_button.configure(state='disabled')
- msg.showinfo('Error 001', 'No Server Found.\nPlease check your connection.')
- # Creating the Button
- a_button = ttk.Button(win, width=12, text='Play Now!', command=clicked)
- a_button.grid(column=3, row=1)
- # Starts the GUI
- win.mainloop()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement