class3_Entry & Text 输入和文本框

程序总体运行效果图如下;

 

 


#!/usr/bin/env python # -*- coding:utf-8 -*- # ------------------------------------------------------------ # # 参考资料: # 用 python 和 tkinter 做简单的窗口视窗 - 网易云课堂 # http://study.163.com/course/courseLearn.htm?courseId=1003216011#/learn/video?lessonId=1003652323&courseId=1003216011 # # # ------------------------------------------------------------ # ******************** class3_entry_text ******************* # ******************** class3_entry_text ******************* # =====>>>>>>内容概览 # =====>>>>>>内容概览 # class3_entry_text # ------------------------------------------------------------ # # 1、 tkinter 之 生成一个窗口 # ------------------------------------------------------------ # ------------------------------------------------------------ # # 2、 tkinter 之 生成一个输入的文本框 # ------------------------------------------------------------ # ------------------------------------------------------------ # # 3、 tkinter 之 生成输的文本框 + 按钮 # ------------------------------------------------------------ # ------------------------------------------------------------ # # 3.1、 tkinter 之 生成输的文本框 + b1按钮 + b2按钮 # ------------------------------------------------------------ # ------------------------------------------------------------ # # 4、 tkinter 之 生成输的文本框 + b1按钮 + b2按钮 + 文本框 # ------------------------------------------------------------ # ------------------------------------------------------------ # # 4.1、 tkinter 之 生成输的文本框 + b1按钮(控制文本框的增加) + b2按钮 + 文本框 # ------------------------------------------------------------ # ------------------------------------------------------------ # # 5、 tkinter 之 生成输的文本框 + b1按钮(控制文本框的内容插入) + b2按钮 +文本框 # ------------------------------------------------------------ # ------------------------------------------------------------ # # 6、 完成!!tkinter 之 生成输的文本框 + b1按钮(控制文本框的内容插入) + b2按钮(控制文本框的内容插入)+ 文本框 # ------------------------------------------------------------
 

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


'''
# ------------------------------------------------------------
# # 1、 tkinter 之 生成一个窗口
# ------------------------------------------------------------
'''

#
# import tkinter as tk
#
# window = tk.Tk()
# window.title('my window')
# window.geometry('200x200')
#
# window.mainloop()









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

'''
# ------------------------------------------------------------
# # 2、 tkinter 之 生成一个输入的文本框
# ------------------------------------------------------------
'''
#
# import tkinter as tk
# window = tk.Tk()
# window.title("my window")
# window.geometry("200x300")
#
# # e = tk.Entry(window, show=None)     # show = None,默认值,把输入的内容全部显示出来
# #
# # e = tk.Entry(window, show="*")      # show = None,默认值,把输入的内容以“*”显示出来
# # e = tk.Entry(window, show="a")      # show = None,默认值,把输入的内容以“a”显示出来
# # e = tk.Entry(window, show="12345")  # show = None,默认值,把输入的内容以“1”显示出来,注意到,这里只是取首个字母
# e = tk.Entry(window)                # 等价于   show = None
# e.pack()
#
# window.mainloop()










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

'''
# ------------------------------------------------------------
# # 3、 tkinter 之 生成输的文本框 + 按钮
# ------------------------------------------------------------
'''
#
# import tkinter as tk
# window = tk.Tk()
# window.title("my window")
# window.geometry("200x300")
#
# e = tk.Entry(window, show=None)     # show = None,默认值,把输入的内容全部显示出来
# e.pack()
#
# b = tk.Button(window, text="insert point", width=15, height=2)
# b.pack()
# window.mainloop()













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

'''
# ------------------------------------------------------------
# # 3.1、 tkinter 之 生成输的文本框 + b1按钮  + b2按钮
# ------------------------------------------------------------
'''
#
# import tkinter as tk
# window = tk.Tk()
# window.title("my window")
# window.geometry("200x300")
#
# e = tk.Entry(window, show=None)     # show = None,默认值,把输入的内容全部显示出来
# e.pack()
#
# b1 = tk.Button(window, text="insert point", width=15, height=2)
# b1.pack()
#
# b2 = tk.Button(window, text="insert end", width=15, height=2)
# b2.pack()
#
# window.mainloop()
#











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

'''
# ------------------------------------------------------------
# # 4、 tkinter 之 生成输的文本框 + b1按钮  + b2按钮 + 文本框
# ------------------------------------------------------------
'''
#
# import tkinter as tk
# window = tk.Tk()
# window.title("my window")
# window.geometry("200x300")
#
# e = tk.Entry(window, show=None)     # show = None,默认值,把输入的内容全部显示出来
# e.pack()
#
#
#
# b1 = tk.Button(window, text="insert point", width=15, height=2 )
#
# b1.pack()
#
# b2 = tk.Button(window, text="insert end", width=15, height=2)
# b2.pack()
#
# t = tk.Text(window, height=2)
# t.pack()
#
# window.mainloop()














# ------------------------------------------------分割线-------------------------------------------------
#
'''
# ------------------------------------------------------------
# # 4.1、 tkinter 之 生成输的文本框 + b1按钮(控制文本框的增加) + b2按钮 + 文本框 
# ------------------------------------------------------------
'''
#
# import tkinter as tk
# window = tk.Tk()
# window.title("my window")
# window.geometry("200x300")
#
# e = tk.Entry(window, show=None)     # show = None,默认值,把输入的内容全部显示出来
# e.pack()
#
# insert_point_flag = False
#
# def insert_point():
#     insert_point_flag = True
#     if insert_point_flag :
#         t = tk.Text(window, height=2)
#         t.pack()
#     else:
#         insert_point_flag = False
#
# b1 = tk.Button(window, text="insert point", width=15, height=2, command=insert_point)
#
# b1.pack()
#
# b2 = tk.Button(window, text="insert end", width=15, height=2)
# b2.pack()
#
#
# window.mainloop()

















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

'''
# ------------------------------------------------------------
# # 5、 tkinter 之 生成输的文本框 + b1按钮(控制文本框的内容插入) + b2按钮 +文本框 
# ------------------------------------------------------------
'''
#
# import tkinter as tk
# window = tk.Tk()
# window.title("my window")
# window.geometry("200x300")
#
# e = tk.Entry(window, show=None)     # show = None,默认值,把输入的内容全部显示出来
# e.pack()
#
#
# def insert_point():
#     var = e.get()
#     t.insert('insert', var)         # insert('insert', var)  ,在光标所在的位置插入内容
#
#
# b1 = tk.Button(window, text="insert point", width=15, height=2, command=insert_point)
#
# b1.pack()
#
# b2 = tk.Button(window, text="insert end", width=15, height=2)
# b2.pack()
#
# t = tk.Text(window, height=2)
# t.pack()
# window.mainloop()










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

'''
# ------------------------------------------------------------
# # 6、 完成!!tkinter 之 生成输的文本框 + b1按钮(控制文本框的内容插入) + b2按钮(控制文本框的内容插入)+ 文本框 
# ------------------------------------------------------------
'''
#
# import tkinter as tk
# window = tk.Tk()
# window.title("my window")
# window.geometry("200x300")
#
# e = tk.Entry(window, show=None)     # show = None,默认值,把输入的内容全部显示出来
# e.pack()
#
#
# def insert_point():
#     var = e.get()
#     t.insert('insert', var)         # insert('insert', var)  ,在光标所在的位置插入内容
#
# def insert_end():
#     var = e.get()
#     t.insert('end', var)            # insert('insert', var)  ,在文本框的末尾处插入内容
#
#
# b1 = tk.Button(window, text="insert point", width=15, height=2, command=insert_point)
# b1.pack()
#
#
# b2 = tk.Button(window, text="insert end", width=15, height=2, command=insert_end)
# b2.pack()
#
# t = tk.Text(window, height=2)
# t.pack()
#
# window.mainloop()
#
#
#

  

 
序号6,程序运行效果图如下;

 
posted @ 2018-08-19 09:43  JY小脚丫  阅读(366)  评论(0编辑  收藏  举报