Giới thiệu sản phẩm
from tkinter import *
#gọi module Tk
cua_so = Tk()
#đặt tên cho window
cua_so.title("My Window")
#thiết lập màu nền hoặc kích thước
#cua_so.configure(width=1080,height=1920,background="red")
cua_so.geometry("400x400")
#tạo nhãn dán
label1 = Label(cua_so,text = "xin chào các bạn", bg="white",fg="blue",font= "Times 32 bold italic")
label1.place(x=100, y= 100)
#tạo cửa sổ mới cho nút2
def newwindow():
Nwindow= Toplevel(cua_so)
Nwindow.title("New Window")
Nwindow.geometry("400x400")
# tính toán tọa độ trung tâm cho tam giác
window_width = 400
window_height = 400
triangle_size = 100
center_x = (window_width - triangle_size) / 2
center_y = (window_height - triangle_size) / 2
# tạo canvas trong cửa sổ mới
c = Canvas(Nwindow, bg="pink", height="400", width="400")
poly = c.create_polygon(center_x, center_y + triangle_size, center_x + triangle_size, center_y, center_x + 2 * triangle_size, center_y + triangle_size, fill="red")
c.pack()
#tạo nút
button1 = Button(cua_so,text ="Quit", command = quit)
button1.place(x=330,y=360)
button2 = Button(cua_so,text ="New Window", command = newwindow)
button2.place(x= 5,y=0)
#tạo vòng lặp cho cửa sổ
cua_so.mainloop()
#gọi module Tk
cua_so = Tk()
#đặt tên cho window
cua_so.title("My Window")
#thiết lập màu nền hoặc kích thước
#cua_so.configure(width=1080,height=1920,background="red")
cua_so.geometry("400x400")
#tạo nhãn dán
label1 = Label(cua_so,text = "xin chào các bạn", bg="white",fg="blue",font= "Times 32 bold italic")
label1.place(x=100, y= 100)
#tạo cửa sổ mới cho nút2
def newwindow():
Nwindow= Toplevel(cua_so)
Nwindow.title("New Window")
Nwindow.geometry("400x400")
# tính toán tọa độ trung tâm cho tam giác
window_width = 400
window_height = 400
triangle_size = 100
center_x = (window_width - triangle_size) / 2
center_y = (window_height - triangle_size) / 2
# tạo canvas trong cửa sổ mới
c = Canvas(Nwindow, bg="pink", height="400", width="400")
poly = c.create_polygon(center_x, center_y + triangle_size, center_x + triangle_size, center_y, center_x + 2 * triangle_size, center_y + triangle_size, fill="red")
c.pack()
#tạo nút
button1 = Button(cua_so,text ="Quit", command = quit)
button1.place(x=330,y=360)
button2 = Button(cua_so,text ="New Window", command = newwindow)
button2.place(x= 5,y=0)
#tạo vòng lặp cho cửa sổ
cua_so.mainloop()
Hình ảnh sản phẩm

Sản phẩm cùng tác giả
Sản phẩm liên quan
Không có sản phẩm nào
Sao mà xịn thế 🙏
Đăng nhập để tham gia bình luận
Sao mà xịn thế 🙏
Đăng nhập để tham gia bình luận
🌹cute za
Đăng nhập để tham gia bình luận
🔥Ngầu như trái bầu
Đăng nhập để tham gia bình luận
sát thương cao quá♥️💕
Đăng nhập để tham gia bình luận
Đăng nhập để tham gia bình luận