tkinter Library - Create window

Use Version: python: 3.7, tkinter: 8.6

A. Establish window

1. Create an object

import tkinter as tk
root = tk.Tk ()
root.mainloop ()

Generating a root window, or called a container (Container)

mianloop () lets refresh cycle program, while similar to the method

 

2. The method associated with the window

  2.1 Settings window title: title ( "Text")

  2.2 window size and position settings: geometry ( "width x height + x + y"): in pixels

  2.3 Set the maximum size of the drag: maxsize (width, height)

  2.4 drag set minimum size: minsize (width, height)

  2.5 Settings window state: state ( "designated four parameters"): normal normal state, iconic minimized window (iconified), zoomed to maximize, withdrawn hidden)

  2.6 minimized window is provided: iconify (): whether the above functions as required research iconic

  2.7 Changing the default window icon: iconbitmap ( "xx.ico")

  2.8 Settings window background color: configure (bg = "color"), Chinese meaning is configured, it should be more than just a function, subsequent need to add

  2.8 whether settings can change the window size: resizable (True, True): The first one is wide, and the second is high

  2.9 Setting exit the program: quit ()

  2.10 setup interface refresh: update ()

  2.11 setup interface refresh: update_idletasks ()

  2.12 coordinate points: winfo_x (), winfo_y ()

Guess you like

Origin www.cnblogs.com/dengzhuoming/p/12130571.html