亚洲乱码中文字幕综合,中国熟女仑乱hd,亚洲精品乱拍国产一区二区三区,一本大道卡一卡二卡三乱码全集资源,又粗又黄又硬又爽的免费视频

Python tkinter布局與按鈕間距設置方式

 更新時間:2020年03月04日 15:32:11   作者:小兜全糖(Cx)  
這篇文章主要介紹了Python tkinter布局與按鈕間距設置方式,具有很好的參考價值,希望對大家有所幫助。一起跟隨小編過來看看吧

新建label與button,并設置位置(grid)

import tkinter as tk
root = tk.Tk()
label = tk.Label(root, text = ‘Label')
label.grid(column = 3, row = 8)

button = tk.Button(root, text = ‘Button')
button.grid(column = 5, row = 1)

按鈕間距設置

col_count, row_count = root.grid_size()

for col in xrange(col_count):
root.grid_columnconfigure(col, minsize=20)

for row in xrange(row_count):
root.grid_rowconfigure(row, minsize=20)

補充知識:Python 窗體(tkinter)按鈕 位置

我就廢話不多說了,還是直接看代碼吧

import tkinter
 
def go(): #函數(shù)
 print("go函數(shù)")
 
win=tkinter.Tk() #構造窗體
win.title("hello zhaolin")#標題
win.geometry("800x800+300+0")#800寬度,800高度,x,y坐標,左上角
button=tkinter.Button(win,text="有種點我",command=go) #收到消息執(zhí)行go函數(shù)
button.pack()#加載到窗體,
button1=tkinter.Button(win,text="有種點",command= lambda :print("hello world"),width=20,height=10) 
button1.pack()#加載到窗體,
#button.place(10,10)
win.mainloop() #進入消息循環(huán)機制
 

以上這篇Python tkinter布局與按鈕間距設置方式就是小編分享給大家的全部內容了,希望能給大家一個參考,也希望大家多多支持腳本之家。

相關文章

最新評論