More than Just Lines on a Map: Best Practices for U.S Bike Routes
Introduction to py gtk
1. Introduction to PyGTK
In this part of the PyGTK programming tutorial, we will talk about the
PyGTK GUI library and Python programming language in general.si
2 คาแนะนาในส่วนของการเขียนโปรแกรม PyGTK น้ ี เราจะ พดเกี่ยวกบ กล่องเครื่องมือPyGTK
ํ ํ 2 ู ั 2 2 2 2
2 GUI และการเขียนโปรแกรมภาษา Python ใน general.si
2 2 2
About this tutorial
This is PyGTK programming tutorial. It has been created and tested on
m
Linux. The PyGTK programming tutorial is suited for novice and more
advanced programmers.
a.i
ee 2
นี่คือคู่มือการสอนการเขียนโปรแกรม PyGTK ซึ่ งได้รับการสร้างและทดสอบบนระบบ Linux
2 2
sin at1 2 2 2
มาแลว การสอนการเขียนโปรแกรม PyGTK เหมาะสําหรับมือใหม่และการเขียนภาษาโปรแกรมขั้นสู ง
้
.th
2 2 2 2 2
ข้ ึนไป
wi ap
PyGTK
PyGTK is a set of Python wrappers for the GTK+ GUI library. It offers a
:// ir
comprehensive set of graphical elements and other useful programming
facilities for creating desktop applications. It is a part of the GNOME
tp Th
project. PyGTK is free software and licensed under the LGPL. Original
autor or PyGTK is James Henstridge. PyGTK is very easy to use, it is
ideal for rapid prototyping. Currently, PyGTK is one of the most popular
bindings for the GTK+ library.
PyGTK เป็ นชุดของโมดูล Python ที่พฒนาเพื่อใช้ทางานร่ วมกับ เครื่องมือ GTK +และ GUI
2 ั ํ 2 2 2 2 2
โดยมีชุดครอบคลุมองค์ประกอบกราฟิ กและ สิ่งอานวยความสะดวกในการเขียนโปรแกรมที่มีประโยชน์
2 ํ 2 2
สําหรับการสร้างโปรแกรมเดสก์ทอปอื่น ๆ มนเป็นส่ วนหนึ่งของโครงการ GNOME PyGTK
ั 2 2 2 2 2
เป็นซอฟตแวร์ ฟรี และได้รับใบอนุญาตภายใต้ LGPL ผเู้ ขียนตนฉบบ หรือ PyGTK คือ
์ ้ ั
ht
2 2 2 2 2
2 James Henstridge PyGTK ถูกออกแบบให้ง่ายต่อการ ใช้ เหมาะสําหรับการสร้างต้น
2 2 2
่ 2 2 2 ั
แบบอยางรวดเร็ว ปัจจุบน PyGTK เป็นหน่ ึงใน โปรแกรมที่นิยมใช้กนมากที่สุดสําหรับกล่องเครื่ องมือ
ั 2 2
2 GTK +
2. PyGTK consists of several modules.
PyGTK ประกอบด้วยโมดูลหลายแบบ
2
GObject is a base class providing the common attributes and functions
for PyGTK classes. ATK is the accessibility toolkit. This toolkit provides
tools which help physically challenged people work with computers. GTK
is the user interface module. The Pango is a library which is used to
work with text and internationalization. Cairo is a library for creating 2D
m
vector graphics. Glade is used to build GUI interfaces from XML
descriptions.
a.i
ee 2
GObject เป็นพ้ืนฐานที่มีคุณสมบัติทวไปและฟังก์ชนสําหรับการเรี ยน PyGTK ATK เป็น
ั่ ั่
sin at12 2 2
เครื่ องมือที่ทาให้เข้าถึงโปรแกรมได้ง่ายขึ้น เครื่องมือ นี้จะช่วยให้คนพิการทางร่ างกายทํางานกับ
ํ
.th
2 2
คอมพิวเตอร์ไดดี GTK คือเครื่องมือ ที่ใชในการเชื่อมต่อกบผใช้ Pango คือกล่องเครื่องมือที่จะใช้
้ 2 2 ้ 2 ั ู้ 2 2 2
wi ap
ในการทํางานเกี่ยวกับคําอรรถที่เป็ นสากล Cairo คือกล่องเครื่ องมือสําหรับการสร้างกราฟิ กแบบเวกเตอร์
2 2
2 2D สวน Glade จะใช้ในการสร้าง GUI ที่มีการเชื่อมต่อกับ XML
2่ 2 2 2 2 2
:// ir
Python
tp Th
Python is a dynamic object-oriented programming language. It is a
general purpose programming language. It can be used for many kinds
of software development. The design purpose of the Python language
emphasizes programmer productivity and code readability. Python was
initially developed by Guido van Rossum. It was first released in 1991.
Python was inspired by ABC, Haskell, Java, Lisp, Icon and Perl
programming languages. Python is a high level, general purpose,
multiplatform, interpreted language. Python is a minimalistic language.
One of its most visible features is that it does not use semicolons nor
ht
brackets. Python uses indentation instead. There are two main branches
of Python currently. Python 2.x and Python 3.x. Python 3.x breaks
backward compatibility with previous releases of Python. It was created
to correct some design flaws of the language and make the language
more clean. The most recent version of Python 2.x is 2.7.1, and of
3. Python 3.x 3.1.3. This tutorial is written in Python 2.x Today, Python is
maintained by a large group of volunteers worldwide.
Python เป็ นภาษาโปรแกรมการเขียนแบบไดนามิกเชิงวัตถุ มีจุดประสงค์ทวไปในการเขียนโปรแกรม
ั่ 2 2
ทางภาษา ที่ใช้สาหรับการพฒนาซอฟตแวร์หลายชนิด วัตถุประสงค์ในการออกแบบการเขียน ภาษาของ
ํ 2 ั2 ์ 2 2
Python เนนผลผลิตนกออกแบบโปรแกรม และความสามารถในการอ่านรหัส Python ได้รับการ
้ ั 2 2
พฒนาคร้ ังแรก โดย Guido van Rossum มีการเปิดตวคร้ ังแรกในปี ค.ศ.1991 Python
ั 2 ั 2
ไดรับแรงบนดาลใจ จากการเขียนโปรแกรมภาษา โดย ABC, Haskell, Java, Lisp, ไอคอน
้ ั 2 2 2 2 2
และ Perl Python เป็นโปรแกรมระดบสูง, มีวตถุประสงค์ทวไป, มีความหลากหลาย, แปลไวหลาย
ั ั ั่ ้
m
2 2 2 2 2 2
ภาษา Python เป็ นภาษาที่เรี ยบง่าย หน่ ึงในคุณสมบติที่เห็นได้ชดที่สุดก็คือ ไม่มีการใช้เครื่ องหมาย
2 2 ั ั 2 2 2
a.i
อัฒภาคหรื อวงเล็บ Python ใช้การเยื้องแทน ปัจจุบน Python มีสองรุ่ น คือ Python 2.x และ
ั
ee 2
2 2 2 2 2
Python 3.x. Python 3.x สามารถนํากลับไปใช้ร่วมกันได้กบรุ่ นก่อนหน้าของ Python ซ่ ึ งถูก
ั
sin at1 2 2 2
.th
สร้างขึ้นเพื่อแก้ไขข้อบกพร่ องของการออกแบบบางส่ วนของภาษา และทําให้ภาษาที่ใช้ชดเจนมากขึ้น รุ่น
2 ั 2
ล่าสุ ดของ Python 2.x คือ 2.7.1 และ Python 3.x คือ 3.1.3 คาแนะนาน้ ีถูกเขียนไวใน
2 2 2 2ํ 2 ํ 2 2้ 2 2 2 2 2 2
wi ap
Python 2.x Python ถูกพัฒนา เก็บรักษาโดยอาสาสมัครกลุ่มใหญ่ทวโลก
2 ั่ 2
GTK+
:// ir
The GTK+ is a library for creating graphical user interfaces. The library
tp Th
is created in C programming language. The GTK+ library is also called
the GIMP Toolkit. Originally, the library was created while developing the
GIMP image manipulation program. Since then, the GTK+ became one
of the most popular toolkits under Linux and BSD Unix. Today, most of
the GUI software in the open source world is created in Qt or in GTK+.
The GTK+ is an object oriented application programming interface. The
object oriented system is created with the Glib object system, which is a
base for the GTK+ library. The GObject also enables to create language
bindings for various other programming languages. Language bindings
ht
exist for C++, Python, Perl, Java, C# and other programming
languages.
GTK + เป็นกล่องเครื่องมือสําหรับการสร้างส่ วนเชื่อมต่อประสานกราฟิ กกับผูใช้ กล่องเครื่องมือน้ ีถูก
้
ถูกพัฒนาจากโปรแกรมภาษา C กล่องเครื่องมือGTK + ซึ่ งเรี ยกว่า GIMP Toolkit เดิมทีถูก
4. สร้างขึ้นเพื่อพัฒนาแก้ไขโปรแกรมการจัดการภาพ GIMP ตั้งแต่น้ นมา GTK + กลายเป็นหน่ ึงในชุด
ั
เครื่ องมือที่นิยมมากที่สุดภายใต้โปรแกรม Linux และ BSD Unix ปัจจุบนน้ ี ซอฟตแวร์ส่วนใหญ่
ั ์
ของGUI ในโลกกว้าง มันถูกสร้างขึ้นในรู ป Qt หรือ GTK + GTK + เป็นโปรแกรมเชื่อมต่อ
ประยุกต์จากการเขียนโปรแกรมเชิงวัตถุ ซึ่ งถูกสร้างขึ้นด้วยฟังชันที่เป็ นฐานสําหรับ กล่องเครื่องมือ GTK
่
่ ํ
+ ในขณะที่ GObject ก็สามารพัฒนาเพื่อรองรับการเชื่อมต่อกับโปรแกรมภาษาอื่น ๆ ที่มีอยูสาหรับ
C + +, Python, Perl, Java, C # และโปรแกรมภาษาอื่น ๆ
Gnome and XFce desktop environments have been created using the
m
GTK+ library. SWT and wxWidgets are well known programming
frameworks, that use GTK+. Prominent software applications that use
GTK+ include Firefox or Inkscape.
a.i
ee 2
Gnome และ XFce เป็นหนากากที่ ได้รับการสร้างขึ้นโดยใช้กล่องเครื่ องมือ GTK +
้
sin at1 2 2 2 2
.th
SWT และ wxWidgets ที่รู้จกกันดี ภายใตกรอบการเขียนโปรแกรมที่ใช้ GTK +
2 2 ั 2 ้ 2 2 2
wi ap
2 ซอฟตแวร์ที่ประยุกต์ใช้ไดโดดเด่นโดย กล่องเครื่องมือ GTK + คือ Firefox หรือ Inkscape
์ 2 2 ้ 2 2 2 2 2 2
:// ir
tp Th
What is PyGTK
PyGTK lets you to easily create programs with a graphical user interface
using the Python programming language. The underlying GTK+ library
provides all kind of visual elements and utilities for it and, if needed, you
can develop full featured applications for the GNOME Desktop.
PyGTK applications are truly multiplatform and they're able to run,
unmodified, on Linux, Windows, MacOS X and other platforms.
Other distinctive features of PyGTK are, besides its ease of use and
ht
rapid prototyping, its first class accessibility support or the capability to
deal with complex multilingual or bidirectional text for fully localized
applications.
5. PyGTK ช่วยให้คุณสามารถสร้างโปรแกรมที่เชื่อมต่อกับผูใช้แบบกราฟิ กโดยใช้การเขียนโปรแกรม
2 ้
2
ภาษาPython ภายในกล่องเครื่องมือ GTK + ประกอบด้วยรู ปภาพที่แสดงให้เห็นหน้าตาอุปกรณ์
2 2 2
ทุกชนิด และโปรแกรมอรรถประโยชน์ อื่น ๆ และถ้าจําเป็ นคุณสามารถพัฒนาโปรแกรมประยุกต์ให้มี
2 2
ประสิ ทธิ ภาพมากขึ้นสําหรับ GNOME desktop 2
2 การใช้งาน PyGTK มีหลากหลายรู ปแบบ และพวกเขาจะสามารถทํางานโดยไม่ตองปรับแต่งในระบบ
2 2 2 2้
2 Linux, Windows, MacOS X และแพลตฟอร์มอื่น ๆ 2 2
2 คุณสมบติที่โดดเด่น อื่น ๆ ของ PyGTK นอกจากจะใช้งานง่าย และสร้างต้นแบบได้อย่างรวดเร็ ว , มี
ั 2 2 2 2
การเข้าถึงหรื อความสามารถในการประสานเชื่อมต่อกับหลายภาษาหรื อ รองรับได้สองภาษาสําหรับการใช้
m
งานเป็ นภาษาท้องถิ่น
a.i
ee 2
PyGTK is free software, so you can use, modify, distribute and study it
sin at1
with very few restrictions (LGPL license).
.th
PyGTK เป็นซอฟตแวร์เสรี เพื่อให้คุณสามารถใช้แก้ไข แจกจ่ายและศึกษารู ้ถึง ข้อจํากัด ที่นอยมาก (
์ 2 ้ 2 2 2 2
ใบอนุญาต LGPL)
wi ap
2 2
gtk.Button
:// ir
gtk.Button — A pushbutton widget that issues a signal when clicked.
tp Th
gtk.Button -- เครื่องมือ ป่ ุมกดเพื่อส่งสัญญาณเมื่อมีการคลิก
2 2 2 2
Description
2 คําอธิ บาย 2
The gtk.Button widget is usually displayed as a pushbutton with a text
label (gtk.Label) though it can contain any valid widget. The gtk.Button
is generally used to attach a callback function or method that is called
ht
when the button is clicked. Buttons generate signals that indicate:
2 2 2 ้่ ั
เครื่องมือ ป่ ุมกดgtk.Button มักจะแสดงเมื่อมีการกดป่ ุมที่ ป้ ายข้อความ (gtk.Label) แมวามนจะ 2 2 1 1 2
2 ์ ั ั
มีความสามารถหลายอย่างก็ตาม แต่โดยทัวไป gtk.Button จะใช้ในการแนบฟังกชนกลบหรือการที่จะ
่ 2 2 2
ถูกเรี ยกเมื่อมีการคลิกปุ่ ม ป่ ุมสร้างสัญญาณทัวไปที่บ่งบอกถึง :
่ 2 2 2
6. "clicked" - the user pressed and released a mouse button over the
button
2 "คลิก"-- ผใชทาการกดและปล่อยป่ ุมเมาส์เหนือป่ ุม
1 1ู้ ้ ํ 2 2
"pressed" - the user pressed a mouse button over the button
2 "แบบกด"-- ผใชกดป่ ุมเมาส์เหนือป่ ุม
ู้ ้ 2
"released" - the user released a mouse button over the button
"ปล่อย"-- ผใชที่ถูกปล่อยออกป่ ุมเมาส์เหนือป่ ุม
ู้ ้
m
2 1 1
"enter" - the pointer entered the button
a.i
"ป้ อน"-- ช้ ีที่ป้อนป่ ุม
ee 2
2 2
"leave" - the pointer left the button
sin at1
.th
2 "ออก" -- ช้ ีซายที่ป่ ุม
1 1 ้
The "clicked" signal is usually the only signal that an application needs
wi ap
to handle.
2 สัญญาณ"คลิก"โดยปกติจะเป็ นสัญญาณเฉพาะที่โปรแกรมต้องการที่จะจัดการ
1 1
:// ir
If a label is being used by the button its text (the "label" property) is
tp Th
retrieved using the get_label() method. The label text is changed
using the set_label() method.
2 2 1 1 ํ ่
หากป้ ายชื่อจะถูกใช้โดยปุ่ มข้อความ ("label" property) จะถูกเรี ยกออกมาดึงมา ใช้ ด้วยการกดคาวา
2 2 2 2
2 get_label () ถ้าอยากเปลี่ยนข้อความในป้ ายชื่อให้กดคําว่า set_label ()
2 2 2 2
The property ("use_underline") that tells a button to use the first
underscore to indicate a mnemonic key is changed using the
set_use_underline(). method. It can be retrieved using the
get_use_underline() method.
ht
2 ั ่
คุณสมบติ ("use_underline") ที่บอกวาปุ่ มเพื่อขีดเส้นใต้เพื่อแสดงว่าเป็ นความจําหลักซึ่ งถูกเปลี่ยน
2 2 2 2 2
โดยใช้ set_use_underline () มนสามารถถูกเรี ยกดูได้โดยใช้วธีกดปุ่ ม
2 ั ิ 2 2 2 2
2 get_use_underline () 2
7. The button's relief style (the "relief" property) is retrieved using the
method get_relief(). The relief style is set to one of
gtk.RELIEF_NONE, gtk.RELIEF_HALF or gtk.RELIEF_NORMAL
using the method set_relief().
รู ปแบบความหนาของขอบ ป่ ุม (the "relief" property) จะถูกดึงมาใช้ดวยการกดที่ get_relief
2 2 2 ้ 2
2 ()รู ปแบบความหนาของขอบ ปุ่ ม จะถูกตั้งค่าให้เป็ นหนึ่งใน gtk.RELIEF_NONE,
2 2
2 gtk.RELIEF_HALF หรือ gtk.RELIEF_NORMAL ใหเ้ ลือกใช้ป่ ุม set_relief
2 2 2 2 2 2
m
gtk.VBox
gtk.VBox — a vertical container box
a.i
ee 2
gtk.VBox -- กล่อง ภาชนะแนวต้ ง
ั
sin at12 2
.th
Implemented Interfaces การเชื่ อมต่ อการใช้ งาน
wi ap
gtk.VBox implements gtk.Buildable
gtk.VBox Properties
:// ir
gtk.Object Properties
tp Th
gtk.Widget Properties
gtk.Container Properties
gtk.Box Properties
gtk.VBox Style Properties
gtk.Widget Style Properties
gtk.VBox Child Properties
ht
gtk.Box Child Properties
gtk.VBox Signal Prototypes
gobject.GObject Signal Prototypes
8. gtk.Object Signal Prototypes
gtk.Widget Signal Prototypes
gtk.Container Signal Prototypes
Description
A gtk.VBox is a container subclassed from gtk.Box that organizes its
child widgets into a single column. The gtk.Box methods are used to
manage the arrangement, spacing, height, and alignment of
the gtk.VBox child widgets though all are allocated the same width.
m
gtk.VBox เป็นภาชนะย่อย จาก gtk.Box ที่จดระเบียบ เครื่องมือลูกในคอลมน์เดียว gtk.Box
2 ั ั
2 2 2 2 2 2 2 2
a.i
ee 2
ใชในการจดการการจัดระยะห่างความสู งและการจัดตําแหน่งของเครื่ องมือขนาดเล็กของ gtk.VBox
้ ั 2 2 2
แต่ท้งหมดมีการจัดสรรความกว้างเท่ากัน
ั
sin at1 2
.th
Constructor
gtk.VBox(homogeneous=False, spacing=0)
wi ap
if True all child widgets are given equal space
homogeneous :
allocations.
:// ir
the additional vertical space between child widgets in
spacing :
pixels.
tp Th
a new gtk.VBox widget
Returns :
2 2 ั
gtk.VBox (= ระยะห่างที่เป็นเน้ือเดียวกน, False = 0) 2 2 2 2
2 ั ้
ที่เป็นเน้ือเดียวกน : ถาเป็นจริง ทั้งหมดเครื่ องมือจะได้รับการจัดสรรพื้นที่ที่เท่ากัน
2 2 2 2 2
ระยะห่าง : ที่ พื้นที่ตามแนวตั้งเพิ่มเติมระหว่างเครื่ องมือในพิกเซล
2 2 2 2
กลับคืน : เครื่องมือใหม่ gtk.VBox
2 2 2 2 2
Creates a new gtk.VBox widget with the spacing between child widgets
ht
specified by spacing. If homogeneous is True all child widgets are
allocated the same space.
การสร้างเครื่องมือ gtk.VBox ใหม่ที่มีระยะห่างระหว่างเครื่ องมือขนาดเล็กที่ระบุไว้โดยระยะห่าง ถา
2 2 2 2้ 2 2 2
ั ั
เป็นเน้ือเดียวกนเป็น True เครื่องมือขนาดเล็กมีการจดสรรพ้ืนที่เดียวกน
ั
gtk.ListStore
9. gtk.ListStore — a list model to use with a gtk.TreeView
2 ั
gtk.ListStore -- รู ปแบบ รายการที่จะใช้กบ gtk.TreeView
2 2
Ancestry
+-- gobject.GObject
+-- gtk.ListStore
2 ปฐมกาล
2 + -- gobject.GObject
2 2
+ -- gtk.ListStore
m
2 2 2
Implemented Interfaces
a.i
ee 2
gtk.ListStore implements gtk.Buildable gtk.TreeModel gtk.TreeDragSourc
e gtk.TreeDragDest gtk.TreeSortable
sin at1
.th
การเชื่อมต่อ การใช้งาน
2 2
gtk.ListStore ดําเนินการ gtk.TreeModel gtk.TreeDragSource
2 2 2 2
wi ap
gtk.Buildable gtk.TreeDragDest gtk.TreeSortable
2 2 2
gtk.ListStore Signal Prototypes
:// ir
gobject.GObject Signal Prototypes
tp Th
gtk.TreeModel Signal Prototypes
gtk.TreeSortable Signal Prototypes
Description
The gtk.ListStore object is a list model for use with
a gtk.TreeView widget. It implements the gtk.TreeModel interface,
the gtk.TreeSortable and the tree drag and drop interfaces.
ht
2 ั
gtk.ListStore เป็นรูปแบบ รายการสําหรับใช้กบเครื่ องมือ gtk.TreeView มนจะดําเนินการ
2 ั 2 2 2
เชื่อมต่อ gtk.TreeModel gtk.TreeSortable โดยการลากเมาส์มาวางและ หยุดการ
2 2 2 2
เชื่อมต่อ
10. The gtk.ListStore objects support the Python mapping and iterator
protocols. See the gtk.TreeModel Description and the PyGTK tutorial for
more information.
gtk.ListStore มีจุดมุ่งหมายเพื่อ สนับสนุนการทําแผนผัง Python และทบทวนขอกาหนดในการ
2 ้ ํ
2 2 2
เชื่อมต่อส่งผานขอมูล ให้ ดู รายละเอียด gtk.TreeModel และ คมือการใช้ PyGTK สําหรับ
่ ้ 2 2 ู่ 2 2 2 2
ขอมูลเพิ่มเติม
้
Constructor
gtk.ListStore(column_type, ...)
m
column_type : the column type of the first column
... : optional types for succeeding columns
a.i
ee 2
Returns : a new gtk.ListStore
sin at1
.th
2 gtk.ListStore (column_type, ... )
2 2
column_type : ชนิดของ คอลัมน์ของคอลัมน์แรก
wi ap
2 2
... : แบบตวเลือก สําหรับคอลัมน์ที่ประสบความสําเร็ จ
2 2 2 ั 2
กลับคืน : gtk.ListStore ใหม่
2 2 2 2
:// ir
gtk.ScrolledWindow
tp Th
gtk.ScrolledWindow — adds scrollbars to its child widget.
gtk.ScrolledWindow -- เพิ่ม แถบเลื่อนไปที่เครื่องมือลูก 2 2
Ancestry
+-- gobject.GObject
+-- gtk.Object
+-- gtk.Widget
+-- gtk.Container
ht
+-- gtk.Bin
+-- gtk.ScrolledWindow
Implemented Interfaces การเชื่อมต่อ การใช้งาน 2
gtk.ScrolledWindow implements gtk.Buildable
11. gtk.ScrolledWindow Properties
gtk.Object Properties
gtk.Widget Properties
gtk.Container Properties
"hadjustment" Read- The gtk.Adjustment for the horizontal
Write- position.
Construct
m
hscrollbar- Read- The horizontal scrollbar display policy; one
policy"" Write of:gtk.POLICY_ALWAYS,gtk.POLICY_AUTOMA
TIC orgtk.POLICY_NEVER.
a.i
ee 2
"shadow-type" Read- The style of bevel around the contents; one
sin at1 Write of:gtk.SHADOW_NONE,gtk.SHADOW_IN,gtk.SHA
DOW_OUT,gtk.SHADOW_ETCHED_IN,gtk.SHADO
.th
W_ETCHED_OUT.
"vadjustment" Read- The gtk.Adjustment for the vertical position.
wi ap
Write-
Const
ruct
:// ir
"vscrollbar- Read- The vertical scrollbar display policy; one
policy" Write of:gtk.POLICY_ALWAYS,gtk.POLICY_AUTOMATIC
tp Th
orgtk.POLICY_NEVER.
"window- Read- Where the contents are located with respect to
placement" Write the scrollbars; one
of:gtk.CORNER_TOP_LEFT,gtk.CORNER_BOTTO
M_LEFT,gtk.CORNER_TOP_RIGHT,gtk.CORNER_
BOTTOM_RIGHT.
"window- Read- If True "window-placement" should be used to
placement-set" Write determine the location of the contents with
respect to the scrollbars.
ht
"hadjustment"อ่านเขียน - สร้าง gtk.Adjustment สาหรับตาแหน่ง ในแนวนอน
2 2 1 2 2 2 2 2 2 ํ ํ 2
hscrollbar อ่านเขียน การแสดงผลในแนวนอนเลื่อนหน่ ึงจาก : 2 2
gtk.POLICY_ALWAYS, orgtk.POLICY_NEVER
2 2
gtk.POLICY_AUTOMATIC
2
" shadow-type "อ่านเขียน รู ปแบบของมุมเอียงที่มีเนื้อหา; หน่ ึงใน :
2 2 1 2 2
12. gtk.SHADOW_NONE, gtk.SHADOW_IN, gtk.SHADOW_OUT,
2 2 2 2
gtk.SHADOW_ETCHED_IN, gtk.SHADOW_ETCHED_OUT 2
"vadjustment"อ่านเขียน - สร้าง gtk.Adjustment สาหรับตาแหน่ง แนวต้ ง
2 2 ํ ํ 1 ั 2 2 2 2 2 2 2
" vscrollbar policy "อ่านเขียน นโยบายการแสดงตามแนวต้งแถบเลื่อนหน่ ึงจาก :
2 ั 1 2 2
gtk.POLICY_ALWAYS, orgtk.POLICY_NEVER
2 2
gtk.POLICY_AUTOMATIC
2
หน้าต่าง"ตาแหน่ง " อ่านเขียน ที่ไหนเน้ือหาที่มีอยเู่ กี่ยวกบการเลื่อนของ; หน่ ึงใน :
2 2 ํ 1 1 ั 2 2
gtk.CORNER_TOP_LEFT, gtk.CORNER_BOTTOM_LEFT,
2 2
m
gtk.CORNER_TOP_RIGHT, gtk.CORNER_BOTTOM_RIGHT
2 2
"หน้าต่างการตั้งค่าตําแหน่ง "อ่านเขียนถาเป็นจริง หน้าต่าง" ตาแหน่ง "ควรจะใชเ้ พื่อกาหนดตาแหน่งของ
2 2 ้ ํ 1 1 ํ ํ 1 1 1 1
เน้ือหาเกี่ยวกบการ
ั
a.i
ee 2
sin at1
gtk.ScrolledWindow Style Properties
.th
gtk.Widget Style Properties
wi ap
"scrollbar- Read The number of pixels between the scrollbars
spacing" and the scrolled window. Available in GTK+2.2
and above.
:// ir
"scrollbar- Read Whether to place scrollbars within the scrolled
within-bevel" window's bevel. Default value:FalseAvailable
tp Th
in GTK+2.12 and above.
"ระยะห่าง scrollbar -"อ่าน จานวนพิกเซลระหวางแถบเลื่อนและเลื่อนหนาต่าง ที่มีอยู่ใน GTK 2.2
2 2 2 ํ ่ 2 2 ้ 2 2 2 2 2
และรุ่นที่สูงกวา
่ 2
2 2 2 ่
"เลื่อนภายใน - เอียง"อ่าน ไม่วาจะเป็ นการเลื่อนไปยังที่ใด ค่าเริ่ มต้นจะยังคงที่ : FalseAvailable
2 2 2 2 2 2 2
ใน GTK 2.12 และที่ระบุมาในข้างต้น
2 2 2 2
gtk.ScrolledWindow Signal Prototypes
gobject.GObject Signal Prototypes
ht
gtk.Object Signal Prototypes
gtk.Widget Signal Prototypes
gtk.Container Signal Prototypes
13. "move
-
def callback(scrolledwindow, direction, user_param1, ...)
focus-
out"
"scroll- def callback(scrolledwindow, scrolltype, horizontal, user_param1,
child" ...)
Description
A gtk.ScrolledWindow is a subclass of gtk.Bin that adds scrollbars to a
single child widget and optionally draws a beveled frame around the
m
child widget. The scrolled window can work in two ways:
gtk.ScrolledWindow เป็น classลูก ของ gtk.Bin ที่เพิ่มแถบเลื่อนไปที่เครื่องมือลูก และ
a.i
ee 2
2 2 2 2 2 2 2
เลือกที่จะวาดกรอบรอบ ๆ เครื่องมือลูก หน้าต่างนี้จะสามารถทํางานในสองวิธี
sin at1 2 2
.th
• Some widgets have native scrolling support using "slots" to
hold gtk.Adjustment objects. Widgets with native scroll support
include gtk.TreeView, gtk.TextView, and gtk.Layout.
wi ap
• Widgets that lack native scrolling support use
the gtk.Viewport widget that acts as an adapter class,
implementing scrollability for child widgets that lack their own
:// ir
scrolling capabilities. Use gtk.Viewport to scroll child widgets such
as gtk.Table, gtk.Box, and so on.
tp Th
• เครื่ องมือบางตัว จะมีการใช้ตวเลื่อนภาพมาตรฐาน "slot"สําหรับส่ งข้อมูลไปยัง
2 2 ั 1 1
gtk.Adjustment เครื่ องมือสําหรับเลื่อนภาพมาตรฐานเหล่านี้ ยังใช้ได้กบ
2 2 ั 2
gtk.TreeView, gtk.TextView และ gtk.Layout
2 2 2 2 2
• เครื่ องมือที่ไม่มีตวเลื่อนภาพมาตรฐาน gtk.Viewport จะทําหน้าที่เป็ นตัวแปลง ดําเนินการ
ั 2 2 2
เลื่อนภาพสําหรับเครื่ องมือลูกที่ไม่สามารถเลื่อนภาพของตัวเอง จึงมีการใช้ gtk.Viewport 2 2 2
เพื่อเลื่อน เครื่องมือลูก เช่น gtk.Table, gtk.Box และอื่น ๆ
2 2 2 2 2
If a widget has native scrolling abilities, it can be added to
ht
the gtk.ScrolledWindow with the gtk.Container.add() method. If a
widget does not, you must first add the widget to a gtk.Viewport, then
add the gtk.Viewport to the scrolled window. The convenience
method add_with_viewport() does exactly this, so you can ignore the
presence of the viewport.
14. ถาเครื่ องมือมีคุณสมบัติในการเลื่อนภาพมาตรฐาน ก็จะถูกเพิ่มเข้าไปใน gtk.ScrolledWindow
2 ้ 2 2 2
กับ วิธีการ gtk.Container.add หากเครื่องมือไม่มี ก่อนอื่นคุณตองเพิ่มเครื่องมือ
2 2 ้ 2 2
gtk.Viewport จากนั้นให้เพิ่ม gtk.Viewport ไปที่หน้าต่างเลื่อน วิธีการที่ สะดวกสบาย คือให้
2 2 2 2 2 2 2 2
ใช้ add_with_viewport () ดังนั้นคุณสามารถยกเลิกการใช้ viewport ไดเ้ ลย
2 2 2
The position of the scrollbars is controlled by the scroll adjustments.
The gtk.ScrolledWindow uses the attributes in an adjustment
(see gtk.Adjustment) as follows:
ตําแหน่งของ แถบเลื่อนที่มีการควบคุมโดยการปรับเลื่อน gtk.ScrolledWindow จะใช้
m
2 2 2 2 2
คุณลักษณะในการปรับ (ดู gtk.Adjustment) ดังนี้ 2 2 2
a.i
the adjustment.lower attribute is the minimum value of the scroll
ee 2
•
region
sin at1 • the adjustment.upper attribute is the maximum value of the scroll
.th
region
• the adjustment.value attribute represents the position of the
scrollbar, which must be
wi ap
between adjustment.lower and adjustment.upper -
adjustment.page_size
• the adjustment.page_size attribute represents the size of the
:// ir
visible scrollable area
• the adjustment.step_increment attribute is the distance to scroll
tp Th
when the small stepper arrows are clicked
• the adjustment.page_increment attribute is the distance to scroll
when the Page Up or Page Down keys are pressed
2 •คุณลักษณะ adjustment.lower เป็นค่าตํ่าสุ ดของแถบเลื่อน
2 2 2 2
•คุณลักษณะ adjustment.upper เป็นค่าสู งสุ ดของแถบเลื่อน
2 2 2 2 2
2 2 ่
•คุณลักษณะ adjustment.value หมายถึงตําแหน่งของแถบเลื่อนซึ่ งจะต้องอยูระหว่าง
2 2 2
adjustment.lower และ adjustment.upper --
2 2 2 2 2
ht
adjustment.page_size
•คุณลักษณะ adjustment.page_size แสดงขนาดของพื้นที่การเลื่อนที่มองเห็นได้
2 2 2 2 2
•คุณลักษณะ adjustment.step_increment เป็ นระยะทางเพื่อเลื่อน เมื่อหวลูกศร
2 2 2 ั 2 2 2
ขนาดเล็กถูกคลิก
2
15. 2 •คุณลักษณะ adjustment.page_increment เป็ นระยะทางเพื่อเลื่อนไปเมื่อกดคียที่
2 2 ์ 2 2
Page Up หรอ Page Down
ื
If a gtk.ScrolledWindow doesn't behave quite as you would like, or
doesn't have exactly the right layout, it's very possible to set up your
scrolling with gtk.Scrollbar and for example a gtk.Table.
ถา gtk.ScrolledWindow ทํางานไม่ได้ตามคุณต้องการหรื อไม่มีรูปแบบที่เหมาะสมก็เป็ นไป
2้ 2 2 2 2
ได้มากที่จะตั้งค่าการเลื่อนของคุณเองด้วย gtk.Scrollbar ตวอยางเช่น gtk.Table
ั ่ 2 2
m
Constructor
a.i
ee 2
gtk.ScrolledWindow(hadjustment=None, vadjustment=None)
sin at1
hadjustment : the horizontal gtk.Adjustment or None
.th
vadjustment : a vertical gtk.Adjustment or None
Returns : a new gtk.ScrolledWindow widget
wi ap
2 การปรับ : gtk.Adjustment แนวนอนหรือ ไม่มี
2 2 2 2 2 2
:// ir
2 การปรับ : gtk.Adjustment แนวต้งหรือ ไม่
2 2 ั 2 2 2 2
tp Th
2 คืน : เครื่องมือ gtk.ScrolledWindow ใหม่
2 2 2 2 2
Creates a new scrolled window with the horizontal and
vertical gtk.Adjustment specified
by hadjustment and vadjustment respectively. These will be shared
with the scrollbars and the child widget to keep the bars in sync with the
child. If hadjustment and vadjustment are None or not specified the
scrolled window will create them for you.
สร้างหนาต่างเลื่อนใหม่ที่มี gtk.Adjustment แนวนอนและแนว ที่กาหนดไวโดย
้ ํ ้
ht
2 2 2 2 2
hadjustment และ vadjustment ตามลําดับ โปรแกรม เหล่าน้ ีจะถูกใชร่วมกน กบ ตวเลื่อน
2 2 2 2 ้ ั ั ั 2 2 2 2
และเครื่องมือลูกเพื่อเก็บไวในแถบประมวลผล ถา hadjustment และ vadjustment ไม่มี
้ ้ 2 2 2 2 2 2
หรื อไม่ได้ระบุไว้ ตัวเลื่อนหน้าต่างจะสร้างโปรแกรมให้เอง
16. gtk.TreeModelSort
gtk.TreeModelSort — a tree model that is a sorted version of a
child gtk.TreeModel
gtk.TreeModelSort — ตารางสามเหลยมเป็นการเรยงลําดบรน
ี่ ี ั ุ่
ของ gtk.TreeModel ลก
ู
Ancestry
m
+-- gobject.GObject
+-- gtk.TreeModelSort (implements gtk.TreeModel, gtk.TreeSortable)
a.i
ee 2
gtk.TreeModelSort
gtk.TreeModelSort -- แบบตารางสามเหลี่ยมรู ป ต้นไม้ที่เป็ นมีการเรี ยงลําดับข้อมูลของ
sin at1
gtk.TreeModel ลูก
2 2
.th
2 2
gtk.TreeModelSort Properties
wi ap
"model" Read-Write- The child model for the gtk.TreeModelSort
Construct to sort.
:// ir
"model"อ่านเขียน – การสร้างแบบจําลอง ลูกสําหรับ gtk.TreeModelSort ในการเรี ยงลําดับ
2 2 2 2 2 2 2
tp Th
ข้อมูล
gtk.TreeModelSort Signal Prototypes
gobject.GObject Signal Prototypes
gtk.TreeSortable Signal Prototypes
gtk.TreeModel Signal Prototypes
Description
A gtk.TreeModelSort is a sorted model of its child model.
ht
A gtk.TreeModelSort implements the gtk.TreeModel interface and
the gtk.TreeSortable interface to manage the sort functions.
The gtk.TreeModelSort objects support the Python mapping and iterator
protocols. See the gtk.TreeModel Description and the PyGTK tutorial for
more information.
17. gtk.TreeModelSort เป็นรูปแบบ การจัดเรี ยงลําดับของ แบบจําลองลูก
2 2 2 2
gtk.TreeModelSort ดาเนินการติดต่อ gtk.TreeModel และเชื่อมต่อกบ
ํ 2 2 ั2 2 2
gtk.TreeSortable เพื่อจดการ เรี ยงลําดับฟังกชน
2 2ั 2 ์ ั 2 2
gtk.TreeModelSort มีวตถุประสงค์เพื่อสนับสนุนการทําแผนผังของ Python และทบทวน
ั 2 2 2 2
ข้อกําหนดในการเชื่อมต่อส่ งผ่านข้อมูล ดู รายละเอียดในคู่มือ gtk.TreeModel และ PyGTK
2 2 2 2 2 2
สําหรับข้อมูลเพิ่มเติม
Constructor
m
gtk.TreeModelSort(child_model)
child_model : a child gtk.TreeModel
a.i
ee 2
Returns : sin at1 A new gtk.TreeModel.
Creates a new gtk.TreeModel, with child_model as the child model.
.th
2 การสร้าง gtk.TreeModel ใหม่ดวย child_model เป็นแบบ จําลองลูก
2 2 ้ 2 2 2 2 2
wi ap
gtk.TreeView
gtk.TreeView — a widget for displaying both trees and lists.
:// ir
gtk.TreeView -- เครื่องมือ สําหรับการแสดงทั้งผังแบบต้นไม้และแบบรายการ
tp Th
2 2 2 2
Ancestry
+-- gobject.GObject
+-- gtk.Object
+-- gtk.Widget
+-- gtk.Container
+-- gtk.TreeView
Implemented Interfaces
ht
ื่
gtk.TreeView ดําเนนการเชอมโยง gtk.Buildable
ิ
gtk.TreeView Properties
gtk.Object Properties
gtk.Widget Properties
18. gtk.Container Properties
"enable-grid- Read- If True, grid lines should be drawn in the tree view
lines" Write ถาเป็นจริง, เส้นรายละเอียดของรู ปภาพ ควรจะวาดในมุมมองแบบ tree
้ 2
view
"enable- Read- If True, the user can search through columns
search" Write interactively. Default value: True
ถ้าเป็ นจริ ง ผูใช้สามารถค้นหาผ่านคอลัมน์โต้ตอบ ค่าเริ่ มต้น : ถูก
้
"enable-tree- Read- If True, tree lines should be drawn in the tree view
lines" Write ถ้าเป็ นจริ ง ผังต้นไม้ควรจะวาดในมุมมอง tree view
m
"expander- Read- The column for the expander
column" Write คอลัมน์ที่มีการขยายความ
a.i
ee 2
"fixed- Read- If True, assume all rows have the same height
height-
sin at1
Write thereby speeding up display. Default value: False.
mode" Available in GTK+ 2.4 and above.
.th
ถ้าเป็ นจริ ง ถือว่าทุกแถวมีความสู งเดียวกัน ดังนั้นจึงแสดงผลทางหน้าจอ
เร็วข้ ึน ค่าเร่ิ มตน : False. ใช้ได้ใน GTK + 2.4 และที่กล่าวมาข้างต้น
้
wi ap
"adjustment" Read- The horizontal Adjustment for the widget
Write ได้มีการปรับแนวนอนสําหรับเครื่ องมือ
:// ir
"headers- Write If True, the column headers respond to click
clickable" events. Default value:False
tp Th
ถ้าเป็ นจริ งส่ วนหัวของคอลัมน์ตอบสนองต่อการคลิกเหตุการณ์ ค่าเริ่ มต้น :
เทจ็
"headers- Read- If True, show the column header buttons. Default
visible" Write value: True
ถ้าเป็ นจริ ง จะแสดงปุ่ มส่ วนหัวของคอลัมน์ ค่าเริ่ มต้น : จริง
"hover- Read- If True, rows expand or collapse if the pointer
expand" Write moves over them. This mode is primarily intended
for treeviews in popups, e.g.
ingtk.ComboBox orgtk.EntryCompletion. Default
ht
value: False. Available in GTK+ 2.6 and above.
ถาเป็นจริง, แถวจะขยายหรือยบตวเมื่อตวช้ ีอยเู่ หนือคาสั่งแต่ละตว โหมดน้ ี
้ ุ ั ั ํ ั
จะมีวตถุประสงค์หลักสําหรับแสดง treeviews ในหนาต่างpop
ั ้
up เช่น orgtk.EntryCompletion in
gtk.ComboBox ค่าเริ่ มต้น : เทจ หาไดใน GTK + 2.6 และรุ่น
็ ้
19. ่
ที่สูงกวา
"hover- Read- If True, the selected row follows the pointer.
selection" Write Currently, this works only for the selection models
gtk.SELECTION_SINGLE and
gtk.SELECTION_BROWSE. This mode is primarily
intended for treeviews in popups, e.g.
ingtk.ComboBox orgtk.EntryCompletion. Default
value: False. Available in GTK+ 2.6 and above.
ถ้าเป็ นจริ ง แถวที่เลือกจะเป็ นไปตามตัวบ่งชี้ ซึ่ งทํางานเฉพาะสําหรับ
รูปแบบ gtk.SELECTION_SINGLE และ
m
gtk.SELECTION_BROWSE ที่เลือกโหมดนี้ มีวตถุประสงค์ ั
หลกสาหรับ การแสดง treeviews ในหนาต่างpop upเช่น
ั ํ ้
a.i
ee 2
orgtk.EntryCompletion ingtk.ComboBox ค่า
sin at1 เริ่มตน : เทจ หาไดใน GTK + 2.6 และนอกเหนือจากน้ ี
้ ็ ้
.th
"level- Read- Extra indentation for each level
indentation" Write การเยื้องเสริ มสําหรับแต่ละระดับ
wi ap
"model" Read- The model for the tree view
Write แบบสําหรับมุมมอง tree view
"reorderable" Read- If True, the view is re-orderable. Default
:// ir
Write value: False
ถาเป็นจริง, มุมมองเป็ น reorderable ค่าเริ่ มต้น : เทจ
้ ็
tp Th
"rubber- Read- If True enable selection of multiple items by
banding" Write dragging the mouse pointer
หากเป็ นจริ ง ช่วยในการเลือกจากรายการหลายรายการโดยการลากตัวชี้
เมาส์
"rules-hint" Read- If True, hint to the theme engine to draw rows in
Write alternating colors. Default value: False.
ถาเป็นจริง, คําใบ้ไปที่รูปแบบเครื่ องมือ ในการวาดแถวที่มีสีสลบกน ค่า
้ ั ั
เริ่มตน : เทจ
้ ็
ht
"search- Read- The model column to search when searching
column" Write through code. Allowed values: >= -1. Default
value: -1
คอลัมน์รูปแบบที่จะค้นหาเมื่อค้นหารหัสผ่าน ค่าที่อนุญาต :> = -1 ค่า
เริ่มตน : -1
้
20. "show- Read- View has expanders
expanders" Write มีตวขยายแสดง
ั
"vadjustment Read- The vertical Adjustment for the widget
" Write มีการปรับแนวตั้งสําหรับเครื่ องมือ
.
gtk.TreeView Style Properties
m
2 คุณสมบัติของ gtk.TreeView
2 25
a.i
ee 2
"allow-rules" Read If True, allow drawing of alternating color rows.
sin at1 Default value: True
.th
ถ้าเป็ นจริ งจะยอมให้มีการสลับแถวสี ได้ ค่าเริ่ มต้น : จริง
"even-row- Read The gtk.gdk.Colorto use for even rows. Available
wi ap
color" in GTK+ 2.2 and above.
gtk.gdk.Color ใชสาหรับทุกแถวที่มีใน GTK + 2.2 และที่
้ ํ
กล่าวมาข้างต้น
:// ir
"expander-size" Read The size of the expander arrow. Allowed values:
>= 0. Default value: 12
tp Th
การขยายขนาดของลูกศร ค่าที่อนุญาต :> = 0 ค่าเริ่ มต้น : 12
"grid-line- Read Dash pattern used to draw the tree view grid
pattern" lines
รู ปแบบเครื่ องหมาย(-) ใช้ในการวาดเส้นรายละเอียดของรู ปภาพใน
มุมมองแบบ tree view
"grid-line- Read Width, in pixels, of the tree view grid lines
width" ความกว้าง ในพิกเซล ของการวาดเส้นรายละเอียดของรู ปภาพในมุมมอง
แบบ tree view
ht
"horizontal- Read The horizontal space between cells. Must be an
separator" even number. Allowed values: >= 0. Default
value: 2
พ้ืนที่ตามแนวนอนระหวางเซลล์ จะตองเป็นเลขคู่ ค่าที่อนุญาต :> = 0
่ ้
ค่าเริ่ มต้น : 2
21. "indent- Read If True, the expanders are indented.
expanders" ถ้าเป็ นจริ ง มีการขยายเยื้อง
"odd-row-color" Read The gtk.gdk.Color to use for odd rows. Available
in GTK+ 2.2 and above.
gtk.gdk.Color ใชสาหรับแถวคี่ หาไดใน GTK + 2.2 และที่
้ ํ ้
กล่าวมาข้างต้น
"row-ending- Read Enable extended row background theming
details" เปิ ดใช้งานรูปแบบขยายแถวพ้ืนหลง
ั
"tree-line- Read Dash pattern used to draw the tree view lines
m
pattern" รู ปแบบเครื่ องหมาย(-) ใช้ในการวาดเส้นที่มุมมองแบบ tree view
"tree-line- Read Width, in pixels, of the tree view lines
a.i
ee 2
width" sin at1 ความกว้างในพิกเซลของเส้นมุมมอง tree view
"vertical- Read The vertical space between cells. Must be an
separator" even number. Allowed values: >= 0. Default
.th
value: 2
พื้นที่ตามแนวตั้งระหว่างเซลล์ จะต้องเป็ นเลขคู่ ค่าที่อนุญาต :> = 0 คา
่
wi ap
เริ่มตน : 2
้
:// ir
gtk.TreeView Signal Prototypes
tp Th
gobject.GObject Signal Prototypes
gtk.Object Signal Prototypes
gtk.Widget Signal Prototypes
gtk.Container Signal Prototypes
"columns-
def callback(treeview, user_param1, ...)
changed"
ht
"cursor-
def callback(treeview, user_param1, ...)
changed"
"expand-
def callback(treeview, logical, expand, open_all, user_p
collapse-cursor-
aram1, ...)
row"
"move-cursor" def callback(treeview, step, count, user_param1, ...)
22. def callback(treeview, path, view_column, user_param
"row-activated"
1, ...)
"row-collapsed" def callback(treeview, iter, path, user_param1, ...)
"row-expanded" def callback(treeview, iter, path, user_param1, ...)
"select-all" def callback(treeview, user_param1, ...)
"select-cursor-
def callback(treeview, user_param1, ...)
parent"
"select-cursor-
def callback(treeview, start_editing, user_param1, ...)
row"
"set-scroll- def callback(treeview, hadjustment, vadjustment, user
m
adjustments" _param1, ...)
"start-
a.i
ee 2
interactive- def callback(treeview, user_param1, ...)
search"
sin at1
"test-collapse-
def callback(treeview, iter, path, user_param1, ...)
.th
row"
"test-expand-
def callback(treeview, iter, path, user_param1, ...)
wi ap
row"
"toggle-cursor-
def callback(treeview, user_param1, ...)
row"
:// ir
"unselect-all" def callback(treeview, user_param1, ...)
tp Th
Description
A gtk.TreeView widget is used to display the contents of any model
implementing the gtk.TreeModel interface. The tree models provided
standard with GTK+ and PyGTK are:
เครื่องมือ gtk.TreeView จะใช้ในการแสดงผลของรู ปแบบโดยการใช้ gtk.TreeModel ใน
2 2 2 2 2 2
การเชื่อมต่อ ซ่ ึงจดใหไวแลว ใน GTK + และ PyGTK ดังนี้ :
2 ั ้ ้ ้
2 2 2 2 2
• gtk.ListStore
ht
• gtk.TreeStore
• gtk.TreeModelSort
In addition, PyGTK provides gtk.GenericTreeModel that allows you to
create your own tree model entirely in Python.
23. นอกจากนี้ PyGTK ยังมี gtk.GenericTreeModel ที่ช่วยใหคุณสร้างแบบจําลองรู ปต้นไม้
2 2 2 ้
2 2 2
ของคุณอย่างครบถ้วนใน Python
The gtk.TreeView uses columns and cell renderers to actually display the
model information. GTK+ and PyGTK provides
gtk.TreeView จะมีคอลัมน์และเซลล์ แสดงข้อมูลรู ปแบบอยู่ ใน GTK + และ PyGTK
2 2 2 2 2
the gtk.TreeViewColumn to manage the display of a column and the
following cell renderers:
m
gtk.TreeViewColumn จดแสดงผลหน้าจอของคอลัมน์และเซลล์ ดังต่อไปนี้ :
ั 2 2
a.i
gtk.CellRendererPixbuf
ee 2
•
• gtk.CellRendererText
•
sin at1 gtk.CellRendererToggle
.th
In addition, PyGTK provides the gtk.GenericCellRenderer that allows you
to create your own cell renderers entirely in Python.
wi ap
นอกจากนี้ PyGTK ยังมี gtk.GenericCellRenderer ที่ช่วยใหคุณสร้างเซลล์อย่าง
2 2 2 2 ้ 2 2
ู่
ครบถวนท้ งหมดในน้ ีอยใน Python
้ ั
:// ir
Constructor
tp Th
gtk.TreeView(model=None)
model : the tree model to display
Returns : A new gtk.TreeView widget.
Creates a new gtk.TreeView widget displaying the model specified
by model.
หลักการทํางาน
ht
gtk.TreeView (รุ่ น = none)
2 2 2 2
2 : Model ต้นไม้ที่จะแสดง 2 2
2 คืน : เครื่องมือ gtk.TreeView ใหม่
2 2 2 2 2 2
2 สร้างเครื่องมือ gtk.TreeView ใหม่แสดงรู ปแบบที่กาหนดโดยรู ปแบบการ
2 2 ํ 2 2
24. gtk.Label
gtk.Label — a widget that displays a limited amount of read-only text
gtk.Label -- เครื่องมือ ที่แสดงจํานวน จํากัด ของข้อความที่อ่านอย่างเดียว
2 2 2 2
Ancestry
+-- gobject.GObject
+-- gtk.Object
+-- gtk.Widget
m
+-- gtk.Misc
+-- gtk.Label
a.i
ee 2
Implemented Interfaces
sin at1
gtk.Label implements gtk.Buildable
.th
gtk.Label Properties
wi ap
gtk.Object Properties
gtk.Widget Properties
:// ir
gtk.Misc Properties
tp Th
"angle" Read- The angle that the baseline of the label makes
Write with the horizontal, in degrees, measured
counterclockwise. An angle of 90 reads from
bottom to top, an angle of 270, from top to
bottom. Ignored if the label is selectable,
wrapped, or ellipsized. Allowed values: [0,360]
Default value: 0. Available in GTK+ 2.6 and
above.
ht
มุมที่ฐานของปายชื่อแนวนอน ปรากฏ ในองศาการวัดแบบทวนเข็ม
้
นาฬิกา มมมองจาก 90 อานจากลางขึ ้นบน มมของ 270, อานจากบนลง
ุ ่ ่ ุ ่
ลาง ยกเว้นถ้าป่ มปายถกกด ถกคลม หรือ เป็นจดไขปลาคาที่อนญาต :
่ ุ ้ ู ู ุ ุ ่ ่ ุ
25. [0360] ค่าเริ่มต้ น : 0 มีครบใน GTK + 2.6 และรุ่นอื่น ๆ
"attributes" Read- A list of Pango style attributes to apply to the text
Write of the label.
รูปแบบรายการของPango มีคณสมบตที่นําไปใช้กบข้อความของ
ุ ัิ ั
ปายชื่อ
้
"cursor- Read The current position of the insertion cursor in
position" chars. Allowed values: >= 0. Default value: 0
m
ตําแหน่งปั จจุบนของเคอร์ เซอร์ ที่แทรกในตัวอักษร ค่าที่อนุญาต :> = 0
ั
a.i
ee 2
ค่าเริ่ มต้ น : 0
sin at1
.th
"ellipsize" Read- The preferred place to ellipsize the string, if the
Write label does not have enough room to display the
entire string, specified as one of the Pango
wi ap
Ellipsize Mode Constants. Note that setting this
property to a value other
:// ir
thanpango.ELLIPSIZE_NONE has the side-effect
that the label requests only enough space to
tp Th
display the ellipsis "...". In particular, this means
that ellipsizing labels don't work well in notebook
tabs, unless the tab's "tab-expand" property is set
toTrue. Other means to set a label's width are
with
thegtk.Widget.set_size_request()and set_width_c
hars()methods. Default
value:pango.ELLIPSIZE_NONE. Available in GTK+
2.6 and above.
ht
ตําแหนงที่ต้องการวางอกษรในเครื่องหมายคําพด ถ้าปายนนไมมีชอง
่ ั ู ้ ั้ ่ ่
เพียงพอที่จะแสดงอักษรทังหมดที่กําหนดไว้ เป็ นหนึงในฟั งชัน Pango
้ ่ ่
Ellipsize Mode Constants. โปรดสงเกตวาการตงคาคณสมบตนี ้
ั ่ ั้ ่ ุ ัิ
26. มีคาอื่น ๆมากกวา ELLIPSIZE_NONE มีผลข้ างเคียงเมื่อ
่ ่
ปายมีการร้องขอพื ้นที่เพียงพอที่จะแสดงจดไขปลา "...". โดยเฉพาะอยาง
้ ุ ่ ่
ยิ่ง เมื่อปายแสดงจดไขปลา "..." ทํางานได้ ไม่ดีในแท็บโน๊ ตบุ๊ค , ยกเว้นใน
้ ุ ่
แท็บ "tab-expand" มีการตังค่าคุณสมบัตเิ ป็ นจริง วิธีการอื่น ๆ เพื่อ
้
กําหนดความกว้างของปาย
้
thegtk.Widget.set_size_request () และ
set_width_chars () ค่าเริ่มต้ น :
m
pango.ELLIPSIZE_NONE ที่มีอยูใน GTK + 2.6
่
และรุ่นอื่นนอกเหนือจากนี ้
a.i
ee 2
"justify" Read- The alignment of the lines in the text of the label
sin at1
Write relative to each other. The possible values
.th
are:gtk.JUSTIFY_LEFT,gtk.JUSTIFY_RIGHT,gtk.JU
STIFY_CENTER,gtk.JUSTIFY_FILL. This does NOT
wi ap
affect the alignment of the label within its
allocation. Default value:gtk.JUSTIFY_LEFT
:// ir
การจัดตําแหน่ งของเส้ นในข้ อความของปายชื่อทีมีความสั มพันธ์ กน ค่ าที่
้ ่ ั
tp Th
เป็ นไปได้ คือ : gtk.JUSTIFY_LEFT,
gtk.JUSTIFY_RIGHT,
gtk.JUSTIFY_CENTER,
gtk.JUSTIFY_FILL ซึ่งไม่ มีผลต่ อการจัดตําแหน่ งของปายชื่อ ้
ทีอยู่ในการจัดสรรของมัน ค่ าเริ่มต้ น : gtk.JUSTIFY_LEF
่
"label" Read- The text of the label. Default value: None
Write
ข้อความของปายชื่อ คาเริ่มต้น : ไมมี
้ ่ ่
ht
"max- Read- The desired maximum width of the label, in
width- Write characters. If this property is set to -1, the width
chars" will be calculated automatically, otherwise the
label will request space for no more than the
requested number of characters. If the "width-
chars" property is set to a positive value, then the
27. "max-width-chars" property is ignored. Allowed
values: >= -1. Default value: -1. Available in
GTK+ 2.6 and above.
ความกว้างสงสดที่ต้องการของปายตามลกษณะตวอกษรนี ้ หาก
ู ุ ้ ั ั ั
คุณสมบัตนี ้ถูกกําหนดเป็ น -1, ความกว้างจะถกคํานวณโดยอตโนมติ
ิ ู ั ั
อีกนัยหนึ่งปายจะขอพื ้นที่ ไม่เกินกว่าจํานวนที่ร้องขอของตัวอักษร
้
หาก"width-chars" มีการตงคาเป็นบวก " "max-width-chars"
ั้ ่
ก็จะตังค่าเป็ นลบ ค่าที่อนุญาต :> = -1 ค่าเริ่มต้ น : -1 หาไดใน GTK
้ ้
m
+ 2.6 และรุ่นอื่นนอกเหนือจากนี ้
a.i
ee 2
"mnemonic Read The mnemonic accelerator key for this label.
sin at1
-keyval" Default value: 16777215
.th
เป็นความจําหลกสําหรับปายกํากบนี ้ คาเริ่มต้น : 16777215
ั ้ ั ่
wi ap
"mnemonic Read- The widget to be activated when the label's
-widget" Write mnemonic key is pressed.
:// ir
เครื่องมือที่จะเปิดใช้งานเมื่อความจําหลกของฉลากถกกด
ั ู
tp Th
"pattern" Write A string with _ characters in positions used to
identify to characters in the text to underline.
Default value:None
สตริ งที่มีอกขระ _ ในตําแหน่งที่ใช้ ในการระบุตวอักษรในข้ อความที่ขีด
ั ั
เส้ นใต้ ค่าเริ่มต้ น : ไมมี
่
"selectable" Read- If True, the label text can be selected with the
Write mouse. Default value: False
ht
ถ้ าเป็ นจริ ง, ข้อความปายกํากบจะสามารถเลือกได้ด้วยเมาส์ คาเริ่มต้น :
้ ั ่
เท็จ
"selection- Read The position of the opposite end of the selection
28. bound" from the cursor in chars. Allowed values: >= 0.
Default value: 0.
ตําแหนงของปลายตรงข้ามของสวนที่เลือกจากเคอร์เซอร์ในตวอกษร คาที่
่ ่ ั ั ่
อนญาต :> = 0 ค่าเริ่มต้ น : 0
ุ
"single-line- Read- If True the label is in single line mode. In single
mode" Write line mode, the height of the label does not
depend on the actual text, it is always set to
ascent + descent of the font. This can be an
m
advantage in situations where resizing the label
because of text changes would be distracting, e.g.
a.i
ee 2
in a statusbar. Default value:False. Available in
sin at1 GTK+ 2.6 and above.
.th
ถ้ าจริ ง ปายชื่อจะอยูในโหมดบรรทัดเดียว , ความสงของปายชื่อไมได้
้ ่ ู ้ ่
ขึ ้นอยกบข้อความที่ปรากฏ มนมกจะถกตง้ั คาตวอกษร จงเป็นข้อ
ู่ ั ั ั ู ่ ั ั ึ
wi ap
ได้ เปรี ยบในกรณีที่มีการปรับขนาดของปาย เนื่องจากการเปลี่ยนแปลง
้
ข้อความ อาจจะทําให้เสียรูป เชน ใน Statusbar คาเริ่มต้น : เท็จ
่ ่
:// ir
หาไดใน GTK + 2.6 และรุ่นอื่นนอกเหนือจากนี ้
้
tp Th
"track- Read- If True the label tracks which links have been
visited- Write clicked. It will then apply the "visited-link-color"
links" color, instead of "link-color". False. Available in
GTK+ 2.18 and above. ถ้ าเป็ นจริ ง เมื่อปุ่ มแทร็ คที่เชื่อมโยงถูก
คลิก จากนนมนจะทําการเชื่อมโยงกบ "visited-link-color"
ั้ ั ั
แทน"link-color". เท็จ หาไดใน GTK + 2.18 ขึ ้นไป
้
ht
"use- Read- If True, the text of the label includes XML markup.
markup" Write Default value: False
ถ้ าเป็ นจริ ง, ข้อความของปายรวมถึง XML markup ค่าเริ่มต้ น :
้
เท็จ
29. "use- Read- If True, an underscore in the text indicates the
nderline" Write next character should be used for the mnemonic
accelerator key. Default value: False
ถ้ าเป็ นจริ ง, ข้ อความที่ขีดเส้ นใต้ ที่ระบุอกษรตัวถัดไปควรจะใช้ สําหรับคีย์
ั
ความจําเร่ง คาเริ่มต้น : เท็จ
่
"width- Read- The desired width of the label, in characters. If
chars" Write this property is set to -1, the width will be
calculated automatically, otherwise the label will
m
request either 3 characters or the property value,
whichever is greater. Allowed values: >= -1.
a.i
ee 2
Default value: -1. Available in GTK+ 2.6 and
sin at1 above.
.th
ความกว้างที่ต้องการของปาย ในด้านตวอกษร ถ้าคณสมบตนี ้ถกกําหนด
้ ั ั ุ ัิ ู
เป็ น -1, ความกว้างจะถกคํานวณโดยอตโนมติ อีกนย คือปายอาจจะ
ู ั ั ั ้
wi ap
ขอให้ ทง้ั 3 ตวอกษรหรือคาอื่น ๆ ซงแล้วแตอยางใดจะมากกวา คาที่
ั ั ่ ึ่ ่ ่ ่ ่
อนญาต :> = -1 ค่าเริ่มต้ น : -1 หาไดใน GTK + 2.6 และรุ่นอื่น
ุ ้
:// ir
นอกเหนือจากนี ้
tp Th
"wrap" Read- If True, wrap lines if the text becomes too wide.
Write Default value: False
หากเป็นจริง ถ้าข้อความกว้างเกินไป บรรทดที่พิมพ์จะถกตด คาเริ่มต้น :
ั ู ั ่
เท็จ
"wrap- Read- If line wrapping is on, this controls how the line
mode" Write wrapping is done. The default
ht
is pango.WRAP_WORD, which means wrap on
word boundaries. Available in GTK+ 2.10 and
above
ถ้ ามีการตัดบรรทัด สิ่งนี ้จะควบคุมวิธีการตัดบรรทัด ค่าเริ่มต้ นคือ
30. pango.WRAP_WORD ซึงหมายถึงขอบเขตของคําที่ถก
่ ู
คมไว้ หาไดใน GTK + 2.10 ขึ ้นไป
ุ ้
gtk.Label Style Properties
gtk.Widget Style Properties
gtk.Label Signal Prototypes
gobject.GObject Signal Prototypes
m
gtk.Object Signal Prototypes
a.i
ee 2
gtk.Widget Signal Prototypes
sin at1
.th
"activate-
current- def callback(label, user_param1, ...)
link"
wi ap
"activate- def callback(label, uri, user_param1, ...)
link"
"copy-
:// ir
clipboard def callback(label, user_param1, ...)
"
tp Th
def callback(label, step, count, extend_selection, user_param1
"move-
cursor" , ...)
"populate def callback(label, menu, user_param1, ...)
-popup"
Description
The gtk.Label is a widget class that displays a limited amount of read-
only text. Labels are used by several widgets (e.g. gtk.Button, and its
ht
subclasses, gtk.MenuItem, etc.) to provide text display as well as by
applications to display messages, etc, to the user. Most of the
functionality of a gtk.Label is directed at modifying the style and layout
of the text within the widget allocation. A gtk.Label is a "windowless"
object which means that it cannot receive events directly.