การใช้งาน Python GUI (Tkinter) :Entry Widgets ( วิดเจ็ตรายการ)

ตอบกระทู้

รูปแสดงอารมณ์
:icon_plusone: :like: :plusone: :gfb: :-D :) :( :-o 8O :? 8) :lol: :x :P :oops: :cry: :evil: :twisted: :roll: :wink: :!: :?: :idea: :arrow: :| :mrgreen: :angry: :baa: :biggrin:
รูปแสดงอารมณ์อื่นๆ

BBCode เปิด
[img] เปิด
[url] เปิด
[Smile icon] เปิด

กระทู้แนะนำ
   

มุมมองที่ขยายได้ กระทู้แนะนำ: การใช้งาน Python GUI (Tkinter) :Entry Widgets ( วิดเจ็ตรายการ)

การใช้งาน Python GUI (Tkinter) :Entry Widgets ( วิดเจ็ตรายการ)

โดย Jom07 » 12/02/2018 4:41 pm

การใช้งาน Python GUI (Tkinter) :Entry Widgets ( วิดเจ็ตรายการ) เป็นการสร้างหน้าาต่างให้ราสามารถกรอกข้อมูลและเก็บข้อมูลได้ เช่น

โค้ด: เลือกทั้งหมด

from tkinter import *

def show_entry_fields():
   print("First Name: %s\nLast Name: %s" % (e1.get(), e2.get()))

master = Tk()
Label(master, text="First Name").grid(row=0)
Label(master, text="Last Name").grid(row=1)

e1 = Entry(master)
e2 = Entry(master)

e1.grid(row=0, column=1)
e2.grid(row=1, column=1)

Button(master, text='Quit', command=master.quit).grid(row=3, column=0, sticky=W, pady=4)
Button(master, text='Show', command=show_entry_fields).grid(row=3, column=1, sticky=W, pady=4)

mainloop( )
ผลรัน

รูปภาพ


ศึกษาจาก : https://www.python-course.eu/tkinter_entry_widgets.php

ข้างบน