当前位置: 首页>>代码示例>>Python>>正文


Python Tk.minsize方法代码示例

本文整理汇总了Python中tkinter.Tk.minsize方法的典型用法代码示例。如果您正苦于以下问题:Python Tk.minsize方法的具体用法?Python Tk.minsize怎么用?Python Tk.minsize使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在tkinter.Tk的用法示例。


在下文中一共展示了Tk.minsize方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: demo

# 需要导入模块: from tkinter import Tk [as 别名]
# 或者: from tkinter.Tk import minsize [as 别名]
def demo():
    """
    Main program to handle command line parameters and then run what they want.
    """
    from tkinter import Tk

    if BibleOrgSysGlobals.verbosityLevel > 0: print( ProgNameVersion )
    #if BibleOrgSysGlobals.verbosityLevel > 1: print( "  Available CPU count =", multiprocessing.cpu_count() )

    print( exp("Running {} demo…").format( ProgName ) )

    tkRootWindow = Tk()
    # Calls to the window manager class (wm in Tk)
    tkRootWindow.geometry( "{}x{}+{}+{}".format( 320, 100, 2000, 100 ) ) # width, height, xOffset, yOffset
    tkRootWindow.title( ProgNameVersion )
    tkRootWindow.minsize( 300, 50 )
    tkRootWindow.maxsize( 400, 200 )

    #geometryMap = parseWindowGeometry( tkRootWindow.winfo_geometry() )
    #print( "geometry", geometryMap )
    #for something in geometryMap:
        #print( repr(something) )


    settings = ApplicationSettings( 'BiblelatorData/', 'BiblelatorSettings/', ProgName )
    settings.load()
    print( str(settings) )
    print( repr(settings) )

    #tkRootWindow.destroy() #  Useful if we want to measure the start-up time

    # Start the program running
    tkRootWindow.mainloop()
开发者ID:openscriptures,项目名称:Biblelator,代码行数:35,代码来源:Settings.py

示例2: main

# 需要导入模块: from tkinter import Tk [as 别名]
# 或者: from tkinter.Tk import minsize [as 别名]
def main():

    root = Tk()
    root.geometry("1400x680+300+300")
    root.minsize(1400, 350)
    app = windowFrame(root)
    root.mainloop()
开发者ID:RagingRoosevelt,项目名称:RecipeManagerV2,代码行数:9,代码来源:gui.py

示例3: main

# 需要导入模块: from tkinter import Tk [as 别名]
# 或者: from tkinter.Tk import minsize [as 别名]
def main():
    rootWindow = Tk()
    rootWindow.title("Congratulations!")
    rootWindow.minsize(width=200, height=200)
    rootWindow.configure(background='blue')
    app = Frame1(rootWindow)

    app.mainloop()
开发者ID:kwilliams3,项目名称:Tkinter-Fun,代码行数:10,代码来源:pythonproj.py

示例4: setupGui

# 需要导入模块: from tkinter import Tk [as 别名]
# 或者: from tkinter.Tk import minsize [as 别名]
def setupGui():
	global window
	global labelShows, labelEpisodes, labelDownloads
	global listShows, listEps, listDownloads
	global btnAbout, btnDownload, btnChooseFolder
	global folderFrame
	global folderName
	window = Tk()
	window.title('iView')
	window.minsize(300, 200)
	
	labelShows = Label(window, text='Shows')
	labelShows.grid(column=0, row=0, sticky=[N,S,E,W])
	
	listShows = Listbox(window)
	listShows.grid(column=0, row=1, sticky=[N,S,E,W])
	listShows.bind('<<ListboxSelect>>', indexEpsEv)
	indexShows()
	
	labelEpisodes = Label(window, text='Episodes')
	labelEpisodes.grid(column=1, row=0, sticky=[N,S,E,W])
	
	listEps = Listbox(window)
	listEps.grid(column=1, row=1, sticky=[N,S,E,W])
	listEps.bind('<<ListboxSelect>>', setEpNumEv)
	indexEps(0)
	
	labelDownloads = Label(window, text='Downloads')
	labelDownloads.grid(column=2, row=0, sticky=[N,S,E,W])
	
	listDownloads = Listbox(window)
	listDownloads.grid(column=2, row=1, sticky=[N,S,E,W])
	
	btnAbout = Button(window, text='About', command=about)
	btnAbout.grid(column=0, row=2, sticky=[N,S,E,W])
	
	btnDownload = Button(window, text='Download', command=download)
	btnDownload.grid(column=1, row=2, sticky=[N,S,E,W])
	
	btnChooseFolder = Button(window, text='Choose Download Folder', command=chooseDir)
	btnChooseFolder.grid(column=2, row=2, sticky=[N,S,E,W])
	
	folderName = Text(window, height=1)
	folderName.grid(column=0, row=3, columnspan=3)
	folderName.insert(END, expanduser("~")+(':Videos:iView:'.replace(':', os.sep)))
	
	window.columnconfigure(0, weight=1)
	window.columnconfigure(1, weight=1)
	window.columnconfigure(2, weight=1)
	window.rowconfigure(1, weight=1)
	
	def updateDownloadList():
		refreshDownloadList()
		window.after(1000, updateDownloadList)
	dlListThrd = threading.Thread(target=updateDownloadList)
	dlListThrd.setName('Update Download List')
	dlListThrd.start()
开发者ID:gitter-badger,项目名称:python-iview,代码行数:59,代码来源:iview-tk.py

示例5: main

# 需要导入模块: from tkinter import Tk [as 别名]
# 或者: from tkinter.Tk import minsize [as 别名]
 def main(cls):
     "Create context for demo and run a test instance."
     NoDefaultRoot()
     root = Tk()
     root.minsize(420, 330)
     root.title('Markov Demo 2')
     test = cls(root)
     test.grid(sticky=NSEW)
     root.grid_rowconfigure(0, weight=1)
     root.grid_columnconfigure(0, weight=1)
     root.mainloop()
开发者ID:jacob-carrier,项目名称:code,代码行数:13,代码来源:recipe-578076.py

示例6: editSettings

# 需要导入模块: from tkinter import Tk [as 别名]
# 或者: from tkinter.Tk import minsize [as 别名]
    def editSettings(cls):

        def commitSettings(messageInDialogIn):
            try:
                SettingsVars.DEFAULT_BOARD = defaultBoardBox.get()
                SettingsVars.REFRESH_INTERVAL = int(refreshIntervalBox.get())
                messageInDialogIn.destroy()
            except ValueError:
                messagebox.showwarning(message="Invalid Settings")
                messageInDialogIn.focus_force()

        settingsDialog = Tk()
        settingsDialog.title('Settings')
        try:
            if os.name == "nt":
                settingsDialog.wm_iconbitmap(bitmap='./gui/images/icon.ico')
        except _tkinter.TclError:
            pass
        settingsDialog.columnconfigure(0, weight=1)
        settingsDialog.rowconfigure(0, weight=1)

        settingsDialog.minsize(width=100, height=50)
        frame = Frame(settingsDialog)

        refreshIntervalLabel = Label(frame)
        refreshIntervalLabel['text'] = 'Refresh Interval'
        refreshIntervalLabel.pack()

        refreshIntervalBox = Entry(frame)
        refreshIntervalBox.insert(0, cls.REFRESH_INTERVAL)
        refreshIntervalBox.pack(fill='both')

        defaultBoardLabel = Label(frame)
        defaultBoardLabel['text'] = 'Default Board'
        defaultBoardLabel.pack()

        defaultBoardBox = Entry(frame)
        defaultBoardBox.insert(0, cls.DEFAULT_BOARD)
        defaultBoardBox.pack(fill='both')

        submitButton = Button(frame)
        submitButton['text'] = 'Ok'
        submitButton['command'] = lambda: commitSettings(settingsDialog)
        submitButton.pack(side="left", expand="yes", fill="both", padx=5, pady=3)

        cancelButton = Button(frame)
        cancelButton['text'] = 'Cancel'
        cancelButton['command'] = settingsDialog.destroy
        cancelButton.pack(fill='both', expand="yes", padx=5, pady=3)

        frame.pack(fill='both', expand="yes", padx=0, pady=0)

        return settingsDialog
开发者ID:Jelloeater,项目名称:chanThreadWatcher,代码行数:55,代码来源:settings.py

示例7: main

# 需要导入模块: from tkinter import Tk [as 别名]
# 或者: from tkinter.Tk import minsize [as 别名]
def main():
  
    sock = initConnection()
    
    root = Tk()
    root.minsize(400, 450)
    #root.geometry("400x250+450+200")
    #root.call('wm', 'attributes', '.', '-topmost', '1')
    app = ChatGUI(root, sock)
    thread_receiver = receiveThread(1, "Receiver-Thread", sock, app)
    thread_receiver.start()
    root.mainloop()
    #thread_receiver._stop() #non necessario
    sock.send("QUIT".encode(encoding='utf_8', errors='strict'))
    sock.close()
开发者ID:skimdz86,项目名称:Utilities,代码行数:17,代码来源:ChatGUIClient.py

示例8: main

# 需要导入模块: from tkinter import Tk [as 别名]
# 或者: from tkinter.Tk import minsize [as 别名]
def main():
    '''Makes the application
    '''
    root = Tk()
    app = Application(master=root)
    app.master.title("Password Generator")
    root.minsize(500, 500)
    root.maxsize(600, 600)

    menubar = Menu(root)
    filemenu = Menu(menubar, tearoff=0)
    filemenu.add_command(label="Exit", command=root.destroy)
    menubar.add_cascade(label="File", menu=filemenu)
    root.config(bg='#2A2C2B', menu=menubar)
    app.mainloop()
开发者ID:bhowmikp,项目名称:Password_Generator,代码行数:17,代码来源:password_generator_gui.py

示例9: main

# 需要导入模块: from tkinter import Tk [as 别名]
# 或者: from tkinter.Tk import minsize [as 别名]
def main():
    
    print(get_display_name())
    sock = initConnection()
    
    root = Tk()
    root.minsize(400, 475)
    #root.geometry("400x250+450+200")
    app = ChatGUI(root, sock)
    thread_receiver = receiveThread(1, "Receiver-Thread", sock, app)
    thread_receiver.start()
    root.mainloop()
    #thread_receiver._stop() #non necessario
    sock.send("QUIT".encode(encoding='utf_8', errors='strict'))
    sock.close()
开发者ID:skimdz86,项目名称:Utilities,代码行数:17,代码来源:BlinkingChatGUIClient.py

示例10: UpdateChooseGui

# 需要导入模块: from tkinter import Tk [as 别名]
# 或者: from tkinter.Tk import minsize [as 别名]
class UpdateChooseGui():
    optionChosen = -1
    optionValues = {}

    def __init__(self):
        self.choose_gui = None
        self.choose_listbox = None

    def get_option(self, choices):
        self.choose_gui = Tk()
        self.choose_gui.title("Choose file to use")
        self.choose_gui.minsize(500, 200)
        self.center(self.choose_gui)
        choose_gui_frame = tkinter.Frame(self.choose_gui)
        choose_gui_frame.pack(fill=tkinter.BOTH, expand=True)
        self.choose_listbox = tkinter.Listbox(choose_gui_frame)
        i = 0
        for choice in choices:
            self.choose_listbox.insert(i, choice["text"])
            self.optionValues[i] = choice["value"]
            i += 1
        self.choose_listbox.pack(side=tkinter.TOP, fill=tkinter.BOTH, expand=True)

        choose_button = tkinter.Button(choose_gui_frame, text="Use version", command=self.set_option)
        choose_button.pack(side=tkinter.BOTTOM, fill=tkinter.X)

        self.choose_gui.mainloop()

        if self.optionChosen > -1:
            return self.optionValues[self.optionChosen]
        else:
            return -1

    def set_option(self):
        self.optionChosen = self.choose_listbox.curselection()[0]
        self.choose_gui.quit()

    def center(self, toplevel):
        toplevel.update_idletasks()
        w = toplevel.winfo_screenwidth()
        h = toplevel.winfo_screenheight()
        size = tuple(int(_) for _ in toplevel.geometry().split('+')[0].split('x'))
        x = w/2 - size[0]/2
        y = h/2 - size[1]/2
        # noinspection PyStringFormat
        toplevel.geometry("%dx%d+%d+%d" % (size + (x, y)))
开发者ID:FliegendeWurst,项目名称:curseDownloader,代码行数:48,代码来源:updater.py

示例11: main

# 需要导入模块: from tkinter import Tk [as 别名]
# 或者: from tkinter.Tk import minsize [as 别名]
 def main(cls):
     # Create the application's root.
     NoDefaultRoot()
     root = Tk()
     # Restrict sizing and add title.
     root.minsize(350, 175)
     root.title('Directory Size')
     # Create the application's icon.
     with open('tree.ico', 'wb') as file:
         file.write(zlib.decompress(base64.b64decode(ICON)))
     root.iconbitmap('tree.ico')
     os.remove('tree.ico')
     # Configure the SizeTree object.
     view = cls(root)
     view.grid(row=0, column=0, sticky=NSEW)
     # Setup the window for resizing.
     root.grid_rowconfigure(0, weight=1)
     root.grid_columnconfigure(0, weight=1)
     # Enter the GUI main event loop.
     root.mainloop()
开发者ID:jacob-carrier,项目名称:code,代码行数:22,代码来源:recipe-577567.py

示例12: Tk

# 需要导入模块: from tkinter import Tk [as 别名]
# 或者: from tkinter.Tk import minsize [as 别名]
from tkinter import Tk, Label

top = Tk()
lbl = Label(top, text = "Hello World", font=("Impact", 72), fg="Blue", bg="black")
lbl.pack()
top.title("My First GUI")
top.minsize(480,140)
top.mainloop()
开发者ID:arpreading,项目名称:ISD2014,代码行数:10,代码来源:tk_label1.py

示例13: WindowApp

# 需要导入模块: from tkinter import Tk [as 别名]
# 或者: from tkinter.Tk import minsize [as 别名]
class WindowApp(object):
    """
    The PDF Stampede app window
    """
    def __init__(self, resizable=(True, True), geometry=(620, 220)):
        assert (isinstance(resizable, (tuple, list)))
        assert (isinstance(geometry, (tuple, list)))

        self.root = Tk()

        self.config = configparser.ConfigParser()
        self.config_file_name = "config.ini"
        self.config.read(self.config_file_name)

        self.default_case = StringVar(value=self.config["DEFAULT"].get("case", "CASE"))
        self.default_team = StringVar(value=self.config["DEFAULT"].get("team", "TEAM"))
        self.default_series = StringVar()
        self.default_last_index = StringVar()

        self.root.title("The Stampede")
        self.root.resizable(width=resizable[0], height=resizable[1])
        self.root.geometry('{}x{}'.format(geometry[0], geometry[1]))
        self.root.minsize(geometry[0], geometry[1])
        self.root.maxsize(geometry[0]+200, geometry[1])
        self.file_name = StringVar()
        self.file_name.trace("w", self.file_name_changed)
        self.stamp_button = None
        self.add_widgets()
        self.add_menus()
        self.center(self.root)

    def add_widgets(self):
        # File
        frame = Frame(self.root)
        frame.pack(side=TOP, fill=X, expand=True, ipady=5)
        file_label = Label(frame, text="PDF File", width=10)
        file_label.pack(side=LEFT, padx=5, pady=5)
        file_entry = Entry(frame, state=DISABLED, textvariable=self.file_name)
        file_entry.pack(padx=5, side=LEFT, fill=X, expand=True)
        file_button = Button(frame, text="Browse...", command=self.choose_pdf)
        file_button.pack(padx=5, side=RIGHT)

        # Case
        frame = Frame(self.root)
        frame.pack(side=TOP, fill=X, expand=True)
        case_label = Label(frame, text="Case", width=10)
        case_label.pack(side=LEFT, padx=5, pady=5)
        case_entry = Entry(frame, textvariable=self.default_case)
        case_entry.pack(fill=X, padx=5, expand=True)

        # Team
        frame = Frame(self.root)
        frame.pack(fill=BOTH, expand=True)
        team_label = Label(frame, text="Team", width=10)
        team_label.pack(side=LEFT, padx=5, pady=5)
        team_entry = Entry(frame, textvariable=self.default_team)
        team_entry.pack(fill=X, padx=5, expand=True)

        # Series
        frame = Frame(self.root)
        frame.pack(fill=BOTH, expand=True)
        series_label = Label(frame, text="Series", width=10)
        series_label.pack(side=LEFT, padx=5, pady=5)
        series_entry = Entry(frame, textvariable=self.default_series)
        series_entry.pack(fill=X, padx=5, expand=True)

        # Last index
        frame = Frame(self.root)
        frame.pack(fill=BOTH, expand=True)
        last_index_label = Label(frame, text="Last index", width=10)
        last_index_label.pack(side=LEFT, padx=5, pady=5)
        last_index_entry = Entry(frame, textvariable=self.default_last_index)
        last_index_entry.pack(fill=X, padx=5, expand=True)

        bottom_frame = Frame(self.root)
        bottom_frame.pack(side=BOTTOM, fill=X, ipady=5, padx=5)

        close_button = Button(bottom_frame, text="Quit", command=self.root.quit)
        close_button.pack(side=RIGHT)
        self.stamp_button = Button(bottom_frame, text="Stamp it!", state=DISABLED, command=self.stamp_it)
        self.stamp_button.pack(side=RIGHT)

    def stamp_it(self):
        stamp_it(
            self.file_name.get(),
            self.default_case.get(),
            self.default_team.get(),
            self.default_series.get(),
            self.default_last_index.get(),
        )

    def add_menus(self):
        menu_bar = Menu(self.root)
        stampede_menu = Menu(menu_bar, tearoff=0)
        stampede_menu.add_command(label="Settings", command=self.edit_default_settings)
        stampede_menu.add_separator()
        stampede_menu.add_command(label="Quit", command=self.root.quit)
        menu_bar.add_cascade(label="Stampede", menu=stampede_menu)

        self.root.config(menu=menu_bar)
#.........这里部分代码省略.........
开发者ID:qcaron,项目名称:stampede,代码行数:103,代码来源:main.py

示例14: _gui

# 需要导入模块: from tkinter import Tk [as 别名]
# 或者: from tkinter.Tk import minsize [as 别名]
def _gui():
  try:
    from tkinter import Tk, ttk, filedialog, messagebox, StringVar, IntVar
    from tkinter.ttk import Button, Entry, Frame, Label, LabelFrame, Notebook, Radiobutton, Style
  except:
    sys.exit("Unable to load tkinter. Aborting.")
  
  def _check_single(): #check the input and accordingly give the output... for the f_single tab
    if txt_f_single_entry.get()=="":
      lbl_f_single_result.config(text="", style="TLabel")
    elif check_afm(txt_f_single_entry.get()):
      lbl_f_single_result.config(text="Έγκυρο ΑΦΜ.", style="valid.TLabel")
    else:
      lbl_f_single_result.config(text="Άκυρο ΑΦΜ.", style="invalid.TLabel")
  
  def _select_input_file():
    strv_f_file_input.set(filedialog.askopenfilename(title="Άνοιγμα αρχείου"))
    if strv_f_file_input.get() != "" and strv_f_file_output.get() != "":
      btn_f_file_submit.config(state="normal")
    else: btn_f_file_submit.config(state="disabled")
#TODO a much better mechanism to enable / disable btn_f_file_submit is needed.
  def _select_output_file():
    strv_f_file_output.set(filedialog.asksaveasfilename(title="Αποθήκευση ως..."))
    if strv_f_file_input.get() != "" and strv_f_file_output.get() != "":
      btn_f_file_submit.config(state="normal")
    else: btn_f_file_submit.config(state="disabled")
  
  def _check_file():#TODO this could / should be merged with the TUI version...
    input_filepath = strv_f_file_input.get()
    output_filepath = strv_f_file_output.get()
    filter_output = intvar_filter_sel.get()
    try:
      input_file = open(input_filepath, "r")
      output_file = open(output_filepath, "w")
    except:
      messagebox.showerror(title="Σφάλμα", message="Αδυναμία διαχείρησης των αρχείων που ορίσατε.\n\nΠαρακαλώ επιβεβαιώστε πως το αρχείο με τα δεδομένα υπάρχει, πως έχετε δικαιώματα ανάγνωσης, και πως έχετε δικαιώματα εγγραφής στον κατάλογο εξαγωγής των αποτελεσμάτων.")
      return
    counter = {True:0, False:0}
    for entry in input_file:
      validation = check_afm(entry.strip())
      counter[validation]+=1
      if filter_output == 3 and validation == False:
        output_file.write(entry)
      elif filter_output == 2 and validation == True:
        output_file.write(entry)
      elif filter_output == 1:
        output_file.write(entry.strip() + "\t" + str(validation) + "\n\r")
    lbl_f_file_result.config(text="Σύνολο: "+str(counter[True]+counter[False])+"\nΈγκυρα: "+str(counter[True])+"\nΆκυρα: "+str(counter[False]))

  #create the window
  main_window = Tk()
  main_window.title("Έλεγχος εγκυρότητας Α.Φ.Μ. (v 2.0)")
  main_window.geometry("600x180")
  main_window.minsize(600,180)

  #fool arround with styling
  style = ttk.Style()
  style.configure("valid.TLabel", background="green")
  style.configure("empty.TLabel", background="white")
  style.configure("invalid.TLabel", background="red")
  style.configure("TNotebook", padding = 10)
  
  #create the Notebook
  tabs = Notebook(main_window)
  f_single = Frame(tabs)
  f_file = Frame(tabs)
  tabs.add(f_single, text="Μεμονομένα Α.Φ.Μ.")
  tabs.add(f_file, text="Λίστα από αρχείο")#add state="disabled" prior to git push until ready
  tabs.pack(anchor="nw")
  
  #add some widgets in f_single tab
  lbl_f_single_instructions = Label(f_single, text="Εισάγετε έναν ΑΦΜ για έλεγχο")
  lbl_f_single_instructions.grid(column=0, row=0)

  lbl_f_single_result = Label(f_single, text="", width=10, justify="center")
  lbl_f_single_result.grid(column=1, row=0, rowspan=2, sticky="ewns")

  txt_f_single_entry = Entry(f_single, width=11)
  txt_f_single_entry.focus()
  txt_f_single_entry.bind("<KeyRelease>", lambda e: _check_single() )
  txt_f_single_entry.grid(column=0,row=1)

  #btn_f_single_submit = Button(f_single, text="Έλεγχος", command=_check_single)
  #btn_f_single_submit.grid(column=0,row=2)
    
  #add some widgets in f_file tab
  lbl_f_file_finput = Label(f_file, text="Άνοιγμα...")
  lbl_f_file_finput.grid(column=0, row=0)
  strv_f_file_input = StringVar()
  txt_f_file_finput = Entry(f_file, textvariable = strv_f_file_input)
  txt_f_file_finput.grid(column=1, row=0)
  btn_f_file_finput = Button(f_file, text="...", width=3, command=_select_input_file)
  btn_f_file_finput.grid(column=2, row=0, sticky="W")
  
  lbl_f_file_foutput = Label(f_file, text="Αποθήκευση ως...")
  lbl_f_file_foutput.grid(column=0, row=1)
  strv_f_file_output = StringVar()
  txt_f_file_foutput = Entry(f_file, textvariable = strv_f_file_output)
  txt_f_file_foutput.grid(column=1, row=1)
  btn_f_file_foutput = Button(f_file, text="...", width=3, command=_select_output_file)
#.........这里部分代码省略.........
开发者ID:C-Makridis,项目名称:check_AFM,代码行数:103,代码来源:checkAFM.py

示例15: __init__

# 需要导入模块: from tkinter import Tk [as 别名]
# 或者: from tkinter.Tk import minsize [as 别名]
class ConfigureGUI:

    def __init__(self):
        #
        # Main application window
        #
        self._root = Tk()
        self._root.title("Othello")
        self._root.focus()
        self._root.minsize(400, 250)
        self._root.columnconfigure(0, weight=1)
        self._root.rowconfigure(1, weight=1)
        
        #
        # Welcome label
        #
        welcome_frame = ttk.Frame(self._root, borderwidth=5)
        welcome_label = ttk.Label(welcome_frame, text="Welcome to GUI Othello!")
        
        welcome_frame.grid(row=0, column=0, sticky="ew")
        welcome_label.grid(row=0, column=0, padx=5, pady=5)
        
        welcome_frame.columnconfigure(0, weight=1)
        
        #
        # Main content (Configuration)
        #
        self._content = ttk.Frame(self._root)
        
        self._row = IntVar()
        row_label = ttk.Label(self._content, text="Number of Rows: ")
        row_picker = ttk.Combobox(self._content, state="readonly", textvariable=self._row, values=[4, 6, 8, 10, 12, 14, 16])
        row_picker.set(8)
        
        self._col = IntVar()
        col_label = ttk.Label(self._content, text="Number of Columns: ")
        col_picker = ttk.Combobox(self._content, state="readonly", textvariable=self._col, values=[4, 6, 8, 10, 12, 14, 16])
        col_picker.set(8)
        
        self._white_starts = BooleanVar()
        white_starts_label = ttk.Label(self._content, text="White starts: ")
        white_starts_picker = ttk.Combobox(self._content, state="readonly", textvariable=self._white_starts, values=[True, False])
        white_starts_picker.current(1)
        
        self._classic_board_str = StringVar()
        classic_board_str_label = ttk.Label(self._content, text="Opening Board Style: ")
        classic_board_str_picker = ttk.Combobox(self._content, state="readonly", textvariable=self._classic_board_str)
        classic_board_str_picker["values"] = ["Classic (white starts in the top left)", "Inverted (black starts in the top left)"]
        classic_board_str_picker.set("Classic (white starts in the top left)")
        
        self._most_wins = BooleanVar()
        most_wins_label = ttk.Label(self._content, text="Most Pieces Wins: ")
        most_wins_picker = ttk.Combobox(self._content, state="readonly", textvariable=self._most_wins, values=[True, False])
        most_wins_picker.current(0)

        self._content.grid(row=1, column=0, sticky="nsew")
        
        row_label.grid(row=0, column=0, sticky=(const.N, const.E), padx=5, pady=2)
        row_picker.grid(row=0, column=1, columnspan=2, sticky=(const.N, const.W, const.E), padx=2, pady=2)
        col_label.grid(row=1, column=0, sticky=(const.N, const.E), padx=5, pady=2)
        col_picker.grid(row=1, column=1, columnspan=2, sticky=(const.N, const.W, const.E), padx=2, pady=2)
        white_starts_label.grid(row=2, column=0, sticky=(const.N, const.E), padx=5, pady=2)
        white_starts_picker.grid(row=2, column=1, columnspan=2, sticky=(const.N, const.W, const.E), padx=2, pady=2)
        classic_board_str_label.grid(row=3, column=0, sticky=(const.N, const.E), padx=5, pady=2)
        classic_board_str_picker.grid(row=3, column=1, columnspan=2, sticky=(const.N, const.W, const.E), padx=2, pady=2)
        most_wins_label.grid(row=4, column=0, sticky=(const.N, const.E), padx=5, pady=2)
        most_wins_picker.grid(row=4, column=1, columnspan=2, sticky=(const.N, const.W, const.E), padx=2, pady=2)
        
        self._content.columnconfigure(0, minsize=70)
        self._content.columnconfigure(1, weight=1, minsize=50)
        self._content.columnconfigure(2, weight=1, minsize=50)
        self._content.rowconfigure(0, weight=1, minsize=30)
        self._content.rowconfigure(1, weight=1, minsize=30)
        self._content.rowconfigure(2, weight=1, minsize=30)
        self._content.rowconfigure(3, weight=1, minsize=30)
        self._content.rowconfigure(4, weight=1, minsize=30)
        
        #
        # Play/Quit buttons frame
        #
        play_frame = ttk.Frame(self._root, borderwidth=5)
        play = ttk.Button(play_frame, text="Play", command=self._press_play)
        cancel = ttk.Button(play_frame, text="Quit", command=exit)
        
        play_frame.grid(row=2, column=0, sticky="nsew")
        play.grid(row=0, column=0, sticky=(const.N, const.S, const.E), padx=5, pady=2)
        cancel.grid(row=0, column=1, sticky=(const.N, const.S, const.W), padx=5, pady=2)
        
        play_frame.columnconfigure(0, weight=1)
        play_frame.columnconfigure(1, weight=1)

    def _press_play(self):
        self._root.destroy()
        self.play = True

    def start(self) -> None:
        self._root.mainloop()
        if not self.play:
            exit()

#.........这里部分代码省略.........
开发者ID:solomc1,项目名称:python,代码行数:103,代码来源:othello_GUI(3).py


注:本文中的tkinter.Tk.minsize方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。