您现在的位置是:主页 > news > 多多进宝cms网站建设/如何制作一个自己的网站

多多进宝cms网站建设/如何制作一个自己的网站

admin2025/5/21 7:18:36news

简介多多进宝cms网站建设,如何制作一个自己的网站,高端公司网站,推广公众号平台的公司place 布局管理器以及绝对位置和相对位置1、place 布局管理器2、place 选项3、源代码1、place 布局管理器 Place 布局管理器:通过坐标精确控制组件的位置 2、place 选项 选项说明取值范围x, y组件左上角的绝对坐标(相当于窗口)非负整数&am…

多多进宝cms网站建设,如何制作一个自己的网站,高端公司网站,推广公众号平台的公司place 布局管理器以及绝对位置和相对位置1、place 布局管理器2、place 选项3、源代码1、place 布局管理器 Place 布局管理器:通过坐标精确控制组件的位置 2、place 选项 选项说明取值范围x, y组件左上角的绝对坐标(相当于窗口)非负整数&am…

place 布局管理器以及绝对位置和相对位置

  • 1、place 布局管理器
  • 2、place 选项
  • 3、源代码

1、place 布局管理器

Place 布局管理器:通过坐标精确控制组件的位置

2、place 选项

选项说明取值范围
x, y组件左上角的绝对坐标(相当于窗口)非负整数,x 和 y 选项用于设置偏移(像素),如果同时设置 relx (rely)和 x(y),那么 place 将优先计算 relx 和 rely ,然后再实现 x 和 y 指定的偏移量
relx, rely组件左上角的坐标(相当于父容器)rely 是相对父组件的位置, 0 是最左边, 0.5 是正中间,1 是最右边;rely 是相对父组件的位置, 0 是最上边, 0.5 是正中间,1 是最下边
width, height组件的宽度和高度非负整数
rewidth, reheight组件的宽度和高度(相当于父容器)与 relx , rely 取值类似
anchor对齐方式,左对齐 “w”" n " s " ," w " ," e " ," nw " 等

3、源代码

from tkinter import *
from tkinter import messagebox
import random
# 导入库文件window = Tk()
window.geometry('500x500')
# 创建主窗口
w1 = Frame(window, width = 200, height = 200, bg = 'green')
w1.place(x = 50, y = 50)Button(window, text = "小涵").place(relx = 0.6, y = 10, relwidth = 0.2, relheight = 0.5)
Button(w1, text = "小柯").place(relx = 0.6, rely = 0.6)
Button(w1, text = "小小琪琪").place(relx = 0.5, rely = 0.2)window.mainloop()
# 主窗口运行