15AH, San Francisco

California, United States.

Send Your Mail At:

tianyingkejishe@sina.cn

Working Hours

Mon-Sat: 9.30am To 7.00pm

标签标题

Autem vel eum iriure dolor in hendrerit in vulputate velit esse molestie consequat, vel illum dolore eu feugiat nulla facilisis at vero eros et dolore feugait.

标签归档

Python=Lable和LableFrame应用

import os
import tkinter as tk
from tkinter import *

master = tk.Tk()
entry1_str = tk.StringVar()

def helloCallBack():
    entry1_str.set("好的回购好的回购好的回购好的回购好的回购好的回购")
    print("hello word")
    
def gui():
    master.title("Lable家族")
    master.geometry("800x480")
    master.update()

    theLableFrame = tk.LabelFrame(master,text="文件列表",padx=5, pady=5,bd=5)
    theLableFrame.pack(fill=BOTH, expand=YES, padx=10, pady=10)
    
    theLable = tk.Label(theLableFrame,width = master.winfo_width(),wraplength = 80,anchor=NW,textvariable=entry1_str)
    theLable.pack(fill=BOTH, expand=YES, padx=10, pady=10)
    
    theButton = tk.Button(master, text ="点我", command = helloCallBack)
    theButton.pack(side='bottom')
    
    master.mainloop()


if __name__ == '__main__':
    gui()
    

实现效果图如下: