Up label 作成: 2021-04-06
更新: 2021-04-06


    label.py
    #!/usr/bin/python from tkinter import * from tkinter import ttk from PIL import Image, ImageTk root = Tk() root.geometry('500x200') root.title('label_2') # Frame as widget container frame1 = ttk.Frame(root) frame1.grid() # Image img = Image.open('./gopigo.jpg') img = ImageTk.PhotoImage(img) # Label 1 label1 = ttk.Label( frame1, image=img) label1.grid(row=0, column=0) # Label 2 label2 = ttk.Label( frame1, text='information : GoPiGo', padding=(20)) # (left, top, right, bottom) label2.grid(row=0, column=1) root.mainloop()
    $ vi label.py $ chmod +x label.py $ ./label.py