class12_pack_grid_place 放置位置

 

其中的部分运行效果图(程序见序号1):

 

 


 

 

 

#!/usr/bin/env python
# -*- coding:utf-8 -*-
# ------------------------------------------------------------
#
# 参考资料:
# 用 python 和 tkinter 做简单的窗口视窗 - 网易云课堂
# https://study.163.com/course/courseLearn.htm?courseId=1003216011#/learn/video?lessonId=1003650351&courseId=1003216011
#
#
# ------------------------------------------------------------
# ******************** class12_pack_grid_place 放置位置 *******************
# ******************** class12_pack_grid_place 放置位置 *******************
# =====>>>>>>内容概览
# =====>>>>>>内容概览

'''

# ------------------------------------------------------------
# # 1、Button 之 pack
# ------------------------------------------------------------

# ------------------------------------------------------------
# # 2、Label 之 grid
# ------------------------------------------------------------

# ------------------------------------------------------------
# # 3、Label 之 place 具体位置
# ------------------------------------------------------------


'''


 

# ------------------------------------------------分割线-------------------------------------------------
# ------------------------------------------------分割线-------------------------------------------------
# ------------------------------------------------分割线-------------------------------------------------

 

 


 

 

# ------------------------------------------------分割线-------------------------------------------------
'''
# ------------------------------------------------------------
# # 1、Button 之 pack
# ------------------------------------------------------------
'''
import tkinter as tk

window = tk.Tk()
window.title('class12_pack_grid_place 放置位置')
window.geometry('400x300')

tk.Button(window, text='top').pack(side='top')
tk.Button(window, text='bottom').pack(side='bottom')
tk.Button(window, text='left').pack(side='left')
tk.Button(window, text='right').pack(side='right')

window.mainloop()









# ------------------------------------------------分割线-------------------------------------------------
'''
# ------------------------------------------------------------
# # 2、Label 之 grid 
# ------------------------------------------------------------
'''
# import tkinter as tk
#
# window = tk.Tk()
# window.title('class12_pack_grid_place 放置位置')
# window.geometry('400x300')
#
# for x in range(4):
#     for y in range(3):
#         '''
#         grid 设置 x 行, y 列
#         '''
#         # tk.Label(window, text=y).grid(row=x, column=y)          #
#         #
#         # # Label 直接按的外部占的空间     横:padx     纵:pady
#         # tk.Label(window, text=y).grid(row=x, column=y, padx=10, pady=10)
#
#         # Label 直接按的内部占的空间     横:ipadx     纵:ipady
#         tk.Label(window, text=y).grid(row=x, column=y, ipadx=10, ipady=5)
#
# window.mainloop()





# ------------------------------------------------分割线-------------------------------------------------
'''
# ------------------------------------------------------------
# # 3、Label 之 place 具体位置
# ------------------------------------------------------------
'''
# import tkinter as tk
#
# window = tk.Tk()
# window.title('class12_pack_grid_place 放置位置')
# window.geometry('400x300')
#
# # 设置标签的锚点是 左上角方向,即 nw
# tk.Label(window, text='place text').place(x=200, y=150, anchor='nw')
#
# window.mainloop()

  

 

 

 

 

 


 

其中的部分运行效果图(程序见序号1):

 

posted @ 2018-08-31 20:33  JY小脚丫  阅读(159)  评论(0编辑  收藏  举报