“gambar beban tkinter” Kode Jawaban

gambar beban tkinter

from tkinter import *
from PIL import ImageTk, Image

root = Tk()

c = Canvas(root, width=500, height=500)
c.pack()

img = ImageTk.PhotoImage(Image.open(r"imagepath\imagename.extension"))
c.create_image(x, y, image=img, anchor=NW)
Blue Badger

gambar beban tkinter

pip install Pillow
Bazinga

Gambar di Tkinter

import tkinter as tk
window = tk()
canvas = Canvas(window, width=300, height=300)
image = PhotoImage('path')
canvas.create_image(height=40, width=40, img=image) 
Tejas Naik

Gambar di Tkinter

import tkinter
from tkinter import *
from PIL import Image, ImageTk

root = Tk()

# Position text in frame
Label(root, text = 'Position image on button', font =('<font_name>', <font_size>)).pack(side = TOP, padx = <x_coordinate#>, pady = <y_coordinate#>)

# Create a photoimage object of the image in the path
photo = PhotoImage(file = "</path/image_name>")

# Resize image to fit on button
photoimage = photo.subsample(1, 2)

# Position image on button
Button(root, image = photoimage,).pack(side = BOTTOM, pady = <y_coordinate#>)
mainloop()
mustafa saad

Jawaban yang mirip dengan “gambar beban tkinter”

Pertanyaan yang mirip dengan “gambar beban tkinter”

Lebih banyak jawaban terkait untuk “gambar beban tkinter” di Python

Jelajahi jawaban kode populer menurut bahasa

Jelajahi bahasa kode lainnya