diff --git a/library/tkinter.po b/library/tkinter.po index cff143b797..4c6e5bc92d 100644 --- a/library/tkinter.po +++ b/library/tkinter.po @@ -3,13 +3,15 @@ # This file is distributed under the same license as the Python package. # # Translators: +# Adrian Liaw , 2018 +# Dr-XYZ , 2025 msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2024-09-24 07:20+0000\n" -"PO-Revision-Date: 2018-05-23 16:13+0000\n" -"Last-Translator: Adrian Liaw \n" +"PO-Revision-Date: 2025-07-13 20:00+0800\n" +"Last-Translator: Dr-XYZ \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" "tw)\n" "Language: zh_TW\n" @@ -33,6 +35,9 @@ msgid "" "available on most Unix platforms, including macOS, as well as on Windows " "systems." msgstr "" +":mod:`tkinter` 套件(「Tk 介面」)是 Tcl/Tk GUI 工具集的標準 Python 介面。Tk " +"和 :mod:`tkinter` 在大多數 Unix 平台(包含 macOS)以及 Windows 系統上都可以使" +"用。" #: ../../library/tkinter.rst:17 msgid "" @@ -42,6 +47,9 @@ msgid "" "is installed, so you can read the Tcl/Tk documentation specific to that " "version." msgstr "" +"從命令列執行 ``python -m tkinter`` 應該會開啟一個展示簡單 Tk 介面的視窗,讓你" +"知道 :mod:`tkinter` 已正確安裝在你的系統上,並且也會顯示已安裝的 Tcl/Tk 版" +"本,這樣你就可以閱讀該版本專屬的 Tcl/Tk 文件。" #: ../../library/tkinter.rst:22 msgid "" @@ -50,6 +58,9 @@ msgid "" "threaded. See the source code for the :mod:`_tkinter` module for more " "information about supported versions." msgstr "" +"Tkinter 支援一系列的 Tcl/Tk 版本,這些版本可以是有或沒有執行緒支援的建構版" +"本。官方的 Python 二進位發行版捆綁了有執行緒支援的 Tcl/Tk 8.6。關於支援版本的" +"更多資訊,請參閱 :mod:`_tkinter` 模組的原始碼。" #: ../../library/tkinter.rst:27 msgid "" @@ -58,6 +69,9 @@ msgid "" "these additions and changes, and refer to the official Tcl/Tk documentation " "for details that are unchanged." msgstr "" +"Tkinter 並非一個輕薄的包裝器,而是加入了相當多自身的邏輯,使其體驗更具 " +"Python 風格(pythonic)。本文件將著重於這些新增和變更,對於未變更的細節,則會" +"引導讀者參閱官方的 Tcl/Tk 文件。" #: ../../library/tkinter.rst:34 msgid "" @@ -66,6 +80,9 @@ msgid "" "available. Most documentation you will find online still uses the old API " "and can be woefully outdated." msgstr "" +"Tcl/Tk 8.5(2007)引入了一套現代化的主題式使用者介面元件,以及一個用以操作它" +"們的新 API。新舊 API 目前都還能使用。你在網路上找到的大多數文件仍使用舊版 " +"API,而且可能已經嚴重過時。" #: ../../library/tkinter.rst:41 msgid "`TkDocs `_" @@ -76,17 +93,20 @@ msgid "" "Extensive tutorial on creating user interfaces with Tkinter. Explains key " "concepts, and illustrates recommended approaches using the modern API." msgstr "" +"關於使用 Tkinter 建立使用者介面的詳盡教學。內容解釋了關鍵概念,並使用現代 " +"API 來說明建議的方法。" #: ../../library/tkinter.rst:45 msgid "" "`Tkinter 8.5 reference: a GUI for Python `_" msgstr "" +"`Tkinter 8.5 reference: a GUI for Python `_" #: ../../library/tkinter.rst:46 msgid "" "Reference documentation for Tkinter 8.5 detailing available classes, " "methods, and options." -msgstr "" +msgstr "Tkinter 8.5 的參考文件,詳細說明了可用的類別、方法和選項。" #: ../../library/tkinter.rst:48 msgid "Tcl/Tk Resources:" @@ -100,7 +120,7 @@ msgstr "`Tk 指令 `_" msgid "" "Comprehensive reference to each of the underlying Tcl/Tk commands used by " "Tkinter." -msgstr "" +msgstr "Tkinter 所使用的每個底層 Tcl/Tk 指令的綜合參考資料。" #: ../../library/tkinter.rst:53 msgid "`Tcl/Tk Home Page `_" @@ -108,7 +128,7 @@ msgstr "`Tcl/Tk 首頁 `_" #: ../../library/tkinter.rst:54 msgid "Additional documentation, and links to Tcl/Tk core development." -msgstr "" +msgstr "額外的文件,以及連至 Tcl/Tk 核心開發的連結。" #: ../../library/tkinter.rst:56 msgid "Books:" @@ -122,7 +142,7 @@ msgstr "" #: ../../library/tkinter.rst:59 msgid "By Mark Roseman. (ISBN 978-1999149567)" -msgstr "由 Mark Roseman 所著。(ISBN 978-1999149567)" +msgstr "由 Mark Roseman 所著。(ISBN 978-1999149567)" #: ../../library/tkinter.rst:61 msgid "" @@ -134,7 +154,7 @@ msgstr "" #: ../../library/tkinter.rst:62 msgid "By Alan D. Moore. (ISBN 978-1788835886)" -msgstr "由 Alan D. Moore 所著。(ISBN 978-1788835886)" +msgstr "由 Alan D. Moore 所著。(ISBN 978-1788835886)" #: ../../library/tkinter.rst:64 msgid "`Programming Python `_" @@ -142,7 +162,7 @@ msgstr "`Programming Python `_" #: ../../library/tkinter.rst:65 msgid "By Mark Lutz; has excellent coverage of Tkinter. (ISBN 978-0596158101)" -msgstr "由 Mark Lutz 所著;大部分 Tkinter 主題都有涵蓋。(ISBN 978-0596158101)" +msgstr "由 Mark Lutz 所著;對 Tkinter 有極佳的涵蓋。(ISBN 978-0596158101)" #: ../../library/tkinter.rst:67 msgid "" @@ -157,12 +177,12 @@ msgid "" "By John Ousterhout, inventor of Tcl/Tk, and Ken Jones; does not cover " "Tkinter. (ISBN 978-0321336330)" msgstr "" -"由 Tcl/Tk 發明者 John Ousterhout 與 Ken Jones 所著;不包含 Tkinter。(ISBN " -"978-0321336330)" +"由 Tcl/Tk 發明者 John Ousterhout 與 Ken Jones 所著;不包含 Tkinter。(ISBN " +"978-0321336330)" #: ../../library/tkinter.rst:72 msgid "Architecture" -msgstr "" +msgstr "架構" #: ../../library/tkinter.rst:74 msgid "" @@ -171,6 +191,8 @@ msgid "" "documentation. Python's binary releases also ship an add-on module together " "with it." msgstr "" +"Tcl/Tk 並非單一函式庫,而是由幾個不同的模組所組成,每個模組都有獨立的功能和官" +"方文件。Python 的二進位發行版也隨附了一個附加模組。" #: ../../library/tkinter.rst:79 msgid "Tcl" @@ -189,6 +211,13 @@ msgid "" "designed around cooperative multitasking, and Tkinter bridges this " "difference (see `Threading model`_ for details)." msgstr "" +"Tcl 是一個動態直譯的程式語言,就像 Python 一樣。雖然它可以作為通用程式語言獨" +"立使用,但它最常被嵌入到 C 應用程式中,作為腳本引擎或 Tk 工具集的介面。Tcl 函" +"式庫有一個 C 介面,可用於建立和管理一個或多個 Tcl 直譯器的實例,在這些實例中" +"執行 Tcl 指令和腳本,並新增以 Tcl 或 C 實作的自訂指令。每個直譯器都有一個事件" +"佇列,並有設施可以向其傳送事件並加以處理。與 Python 不同,Tcl 的執行模型是圍" +"繞著協同多工(cooperative multitasking)設計的,而 Tkinter 則彌合了這種差異" +"(詳情請參閱 `Threading model`_)。" #: ../../library/tkinter.rst:92 ../../library/tkinter.rst:907 msgid "Tk" @@ -202,6 +231,10 @@ msgid "" "Tk's widgets are very customizable, though at the cost of a dated " "appearance. Tk uses Tcl's event queue to generate and process GUI events." msgstr "" +"Tk 是一個以 C 實作的 `Tcl 套件 `_,它新增了" +"自訂指令來建立和操作 GUI 元件。每個 :class:`Tk` 物件都嵌入了自己載入 Tk 的 " +"Tcl 直譯器實例。Tk 的元件非常可自訂,但代價是外觀較為過時。Tk 使用 Tcl 的事件" +"佇列來產生和處理 GUI 事件。" #: ../../library/tkinter.rst:99 msgid "Ttk" @@ -214,12 +247,17 @@ msgid "" "is distributed as part of Tk, starting with Tk version 8.5. Python bindings " "are provided in a separate module, :mod:`tkinter.ttk`." msgstr "" +"主題式 Tk(Ttk)是較新的一族 Tk 元件,相較於許多傳統的 Tk 元件,它在不同平台" +"上提供了更好的外觀。從 Tk 8.5 版開始,Ttk 作為 Tk 的一部分發行。Python 的綁定" +"(bindings)則在一個獨立的模組 :mod:`tkinter.ttk` 中提供。" #: ../../library/tkinter.rst:105 msgid "" "Internally, Tk and Ttk use facilities of the underlying operating system, i." "e., Xlib on Unix/X11, Cocoa on macOS, GDI on Windows." msgstr "" +"在內部,Tk 和 Ttk 使用底層作業系統的設施,即 Unix/X11 上的 Xlib、macOS 上的 " +"Cocoa、Windows 上的 GDI。" #: ../../library/tkinter.rst:108 msgid "" @@ -230,10 +268,14 @@ msgid "" "interpreter will then call into the Tk and/or Ttk packages, which will in " "turn make calls to Xlib, Cocoa, or GDI." msgstr "" +"當你的 Python 應用程式使用 Tkinter 中的類別(例如,建立一個元件)時,:mod:" +"`tkinter` 模組會先組合一個 Tcl/Tk 指令字串。它將該 Tcl 指令字串傳遞給一個內部" +"的 :mod:`_tkinter` 二進位模組,後者再呼叫 Tcl 直譯器來對其進行計算。Tcl 直譯" +"器接著會呼叫 Tk 和/或 Ttk 套件,而這些套件又會再呼叫 Xlib、Cocoa 或 GDI。" #: ../../library/tkinter.rst:116 msgid "Tkinter Modules" -msgstr "" +msgstr "Tkinter 模組" #: ../../library/tkinter.rst:118 msgid "" @@ -241,6 +283,8 @@ msgid "" "need the main :mod:`tkinter` module, as well as the :mod:`tkinter.ttk` " "module, which provides the modern themed widget set and API::" msgstr "" +"對 Tkinter 的支援分散在數個模組中。大多數應用程式將需要主要的 :mod:`tkinter` " +"模組,以及 :mod:`tkinter.ttk` 模組,後者提供了現代主題式元件集和 API: ::" #: ../../library/tkinter.rst:123 msgid "" @@ -256,12 +300,15 @@ msgid "" "application, and initialize a Tcl interpreter for this widget. Each " "instance has its own associated Tcl interpreter." msgstr "" +"建構一個頂層 Tk 元件,它通常是應用程式的主視窗,並為此元件初始化一個 Tcl 直譯" +"器。每個實例都有其自己關聯的 Tcl 直譯器。" #: ../../library/tkinter.rst:133 msgid "" "The :class:`Tk` class is typically instantiated using all default values. " "However, the following keyword arguments are currently recognized:" msgstr "" +":class:`Tk` 類別通常使用所有預設值來實例化。然而,目前可辨識下列關鍵字引數:" #: ../../library/tkinter.rst:136 msgid "*screenName*" @@ -271,7 +318,7 @@ msgstr "*screenName*" msgid "" "When given (as a string), sets the :envvar:`DISPLAY` environment variable. " "(X11 only)" -msgstr "" +msgstr "當給定(作為字串)時,設定 :envvar:`DISPLAY` 環境變數。(僅限 X11)" #: ../../library/tkinter.rst:139 msgid "*baseName*" @@ -282,6 +329,8 @@ msgid "" "Name of the profile file. By default, *baseName* is derived from the " "program name (``sys.argv[0]``)." msgstr "" +"設定檔的名稱。預設情況下,*baseName* 是從程式名稱(``sys.argv[0]``)衍生而" +"來。" #: ../../library/tkinter.rst:142 msgid "*className*" @@ -292,6 +341,8 @@ msgid "" "Name of the widget class. Used as a profile file and also as the name with " "which Tcl is invoked (*argv0* in *interp*)." msgstr "" +"元件類別的名稱。用作設定檔,也用作呼叫 Tcl 時的名稱(*interp* 中的 " +"*argv0*)。" #: ../../library/tkinter.rst:145 msgid "*useTk*" @@ -302,6 +353,8 @@ msgid "" "If ``True``, initialize the Tk subsystem. The :func:`tkinter.Tcl() ` " "function sets this to ``False``." msgstr "" +"若為 ``True``,則初始化 Tk 子系統。:func:`tkinter.Tcl() ` 函式會將此設定" +"為 ``False``。" #: ../../library/tkinter.rst:148 msgid "*sync*" @@ -312,6 +365,8 @@ msgid "" "If ``True``, execute all X server commands synchronously, so that errors are " "reported immediately. Can be used for debugging. (X11 only)" msgstr "" +"若為 ``True``,則同步執行所有 X 伺服器指令,以便立即回報錯誤。可用於偵錯。" +"(僅限 X11)" #: ../../library/tkinter.rst:151 msgid "*use*" @@ -324,12 +379,17 @@ msgid "" "specified in the same way as the value for the -use option for toplevel " "widgets (that is, it has a form like that returned by :meth:`winfo_id`)." msgstr "" +"指定要嵌入應用程式的視窗 *id*,而不是將其建立為獨立的頂層視窗。*id* 必須以與" +"頂層元件的 -use 選項值相同的方式指定(也就是說,其形式類似 :meth:`winfo_id` " +"回傳的形式)。" #: ../../library/tkinter.rst:158 msgid "" "Note that on some platforms this will only work correctly if *id* refers to " "a Tk frame or toplevel that has its -container option enabled." msgstr "" +"請注意,在某些平台上,只有當 *id* 指向一個已啟用 -container 選項的 Tk 框架或" +"頂層視窗時,此功能才能正常運作。" #: ../../library/tkinter.rst:161 msgid "" @@ -339,6 +399,10 @@ msgid "" "py`. The path for the profile files is the :envvar:`HOME` environment " "variable or, if that isn't defined, then :data:`os.curdir`." msgstr "" +":class:`Tk` 會讀取名為 :file:`.{className}.tcl` 和 :file:`.{baseName}.tcl` 的" +"設定檔,並在 Tcl 直譯器中進行直譯,並對 :file:`.{className}.py` 和 :file:`." +"{baseName}.py` 的內容呼叫 :func:`exec`。設定檔的路徑是 :envvar:`HOME` 環境變" +"數,如果未定義,則是 :data:`os.curdir`。" #: ../../library/tkinter.rst:170 msgid "" @@ -346,6 +410,8 @@ msgid "" "provides access to the Tcl interpreter. Each widget that is attached the " "same instance of :class:`Tk` has the same value for its :attr:`tk` attribute." msgstr "" +"透過實例化 :class:`Tk` 建立的 Tk 應用程式物件。這提供了對 Tcl 直譯器的存取。" +"每個附加到同一個 :class:`Tk` 實例的元件,其 :attr:`tk` 屬性都具有相同的值。" #: ../../library/tkinter.rst:177 msgid "" @@ -357,12 +423,18 @@ msgid "" "tree-like relationship while *master*/*slave* reflects the container " "structure." msgstr "" +"包含此元件的元件物件。對於 :class:`Tk`,*master* 是 :const:`None`,因為它是主" +"視窗。*master* 和 *parent* 這兩個術語很相似,有時會作為引數名稱互換使用;然" +"而,呼叫 :meth:`winfo_parent` 會回傳元件名稱的字串,而 :attr:`master` 則回傳" +"物件。*parent*/*child* 反映了樹狀關係,而 *master*/*slave* 反映了容器結構。" #: ../../library/tkinter.rst:187 msgid "" "The immediate descendants of this widget as a :class:`dict` with the child " "widget names as the keys and the child instance objects as the values." msgstr "" +"此元件的直接子代,形式為一個 :class:`dict`,其中鍵為子元件的名稱,值為子實例" +"物件。" #: ../../library/tkinter.rst:194 msgid "" @@ -375,10 +447,15 @@ msgid "" "window created (and the Tk subsystem initialized) by calling its :meth:" "`loadtk` method." msgstr "" +":func:`Tcl` 函式是一個工廠函式,它建立的物件與 :class:`Tk` 類別建立的物件非常" +"相似,只是它不會初始化 Tk 子系統。這在驅動 Tcl 直譯器時最為有用,尤其是在不希" +"望建立額外頂層視窗的環境中,或者在無法建立的環境中(例如沒有 X 伺服器的 Unix/" +"Linux 系統)。由 :func:`Tcl` 物件建立的物件可以透過呼叫其 :meth:`loadtk` 方法" +"來建立一個頂層視窗(並初始化 Tk 子系統)。" #: ../../library/tkinter.rst:203 msgid "The modules that provide Tk support include:" -msgstr "" +msgstr "提供 Tk 支援的模組包括:" #: ../../library/tkinter.rst:205 msgid ":mod:`tkinter`" @@ -394,7 +471,7 @@ msgstr ":mod:`tkinter.colorchooser`" #: ../../library/tkinter.rst:209 msgid "Dialog to let the user choose a color." -msgstr "" +msgstr "讓使用者選擇顏色的對話方塊。" #: ../../library/tkinter.rst:211 msgid ":mod:`tkinter.commondialog`" @@ -402,7 +479,7 @@ msgstr ":mod:`tkinter.commondialog`" #: ../../library/tkinter.rst:212 msgid "Base class for the dialogs defined in the other modules listed here." -msgstr "" +msgstr "此處列出的其他模組中定義的對話方塊的基底類別。" #: ../../library/tkinter.rst:214 msgid ":mod:`tkinter.filedialog`" @@ -410,7 +487,7 @@ msgstr ":mod:`tkinter.filedialog`" #: ../../library/tkinter.rst:215 msgid "Common dialogs to allow the user to specify a file to open or save." -msgstr "" +msgstr "讓使用者指定要開啟或儲存的檔案的通用對話方塊。" #: ../../library/tkinter.rst:217 msgid ":mod:`tkinter.font`" @@ -418,7 +495,7 @@ msgstr ":mod:`tkinter.font`" #: ../../library/tkinter.rst:218 msgid "Utilities to help work with fonts." -msgstr "" +msgstr "協助處理字型的工具程式。" #: ../../library/tkinter.rst:220 msgid ":mod:`tkinter.messagebox`" @@ -426,7 +503,7 @@ msgstr ":mod:`tkinter.messagebox`" #: ../../library/tkinter.rst:221 msgid "Access to standard Tk dialog boxes." -msgstr "" +msgstr "存取標準的 Tk 對話方塊。" #: ../../library/tkinter.rst:223 msgid ":mod:`tkinter.scrolledtext`" @@ -434,7 +511,7 @@ msgstr ":mod:`tkinter.scrolledtext`" #: ../../library/tkinter.rst:224 msgid "Text widget with a vertical scroll bar built in." -msgstr "" +msgstr "內建垂直捲軸的文字元件。" #: ../../library/tkinter.rst:226 msgid ":mod:`tkinter.simpledialog`" @@ -442,7 +519,7 @@ msgstr ":mod:`tkinter.simpledialog`" #: ../../library/tkinter.rst:227 msgid "Basic dialogs and convenience functions." -msgstr "" +msgstr "基本的對話方塊和便利函式。" #: ../../library/tkinter.rst:229 msgid ":mod:`tkinter.ttk`" @@ -453,10 +530,12 @@ msgid "" "Themed widget set introduced in Tk 8.5, providing modern alternatives for " "many of the classic widgets in the main :mod:`tkinter` module." msgstr "" +"在 Tk 8.5 中引入的主題式元件集,為主 :mod:`tkinter` 模組中的許多傳統元件提供" +"了現代化的替代方案。" #: ../../library/tkinter.rst:233 msgid "Additional modules:" -msgstr "" +msgstr "額外模組:" #: ../../library/tkinter.rst:238 msgid ":mod:`_tkinter`" @@ -470,6 +549,9 @@ msgid "" "(or DLL), but might in some cases be statically linked with the Python " "interpreter." msgstr "" +"一個包含 Tcl/Tk 低階介面的二進位模組。它由主 :mod:`tkinter` 模組自動引入,應" +"用程式開發者不應直接使用它。它通常是一個共享函式庫(或 DLL),但在某些情況下" +"可能會與 Python 直譯器靜態連結。" #: ../../library/tkinter.rst:245 msgid ":mod:`idlelib`" @@ -479,7 +561,7 @@ msgstr ":mod:`idlelib`" msgid "" "Python's Integrated Development and Learning Environment (IDLE). Based on :" "mod:`tkinter`." -msgstr "" +msgstr "Python 的整合開發與學習環境(IDLE)。基於 :mod:`tkinter`。" #: ../../library/tkinter.rst:249 msgid ":mod:`tkinter.constants`" @@ -491,6 +573,8 @@ msgid "" "parameters to Tkinter calls. Automatically imported by the main :mod:" "`tkinter` module." msgstr "" +"在將各種參數傳遞給 Tkinter 呼叫時,可用於替代字串的符號常數。由主 :mod:" +"`tkinter` 模組自動引入。" #: ../../library/tkinter.rst:254 msgid ":mod:`tkinter.dnd`" @@ -501,6 +585,7 @@ msgid "" "(experimental) Drag-and-drop support for :mod:`tkinter`. This will become " "deprecated when it is replaced with the Tk DND." msgstr "" +"(實驗性)對 :mod:`tkinter` 的拖放支援。當它被 Tk DND 取代時,將會被棄用。" #: ../../library/tkinter.rst:258 msgid ":mod:`turtle`" @@ -508,11 +593,11 @@ msgstr ":mod:`turtle`" #: ../../library/tkinter.rst:259 msgid "Turtle graphics in a Tk window." -msgstr "" +msgstr "在 Tk 視窗中的海龜繪圖。" #: ../../library/tkinter.rst:263 msgid "Tkinter Life Preserver" -msgstr "" +msgstr "Tkinter 應急指南" #: ../../library/tkinter.rst:265 msgid "" @@ -522,6 +607,9 @@ msgid "" "application looks like, identifies foundational Tk concepts, and explains " "how the Tkinter wrapper is structured." msgstr "" +"本節並非旨在成為 Tk 或 Tkinter 的詳盡教學。為此,請參閱前面提到的外部資源之" +"一。相反地,本節提供了一個快速導覽,介紹 Tkinter 應用程式的外觀、識別基礎的 " +"Tk 概念,並解釋 Tkinter 包裝器的結構。" #: ../../library/tkinter.rst:271 msgid "" @@ -530,10 +618,12 @@ msgid "" "find more detailed documentation on them, including in the official Tcl/Tk " "reference manual." msgstr "" +"本節的其餘部分將幫助你識別在 Tkinter 應用程式中所需的類別、方法和選項,以及在" +"哪裡可以找到關於它們的更詳細文件,包括在官方的 Tcl/Tk 參考手冊中。" #: ../../library/tkinter.rst:278 msgid "A Hello World Program" -msgstr "" +msgstr "一個 Hello World 程式" #: ../../library/tkinter.rst:280 msgid "" @@ -541,6 +631,8 @@ msgid "" "This isn't the smallest one we could write, but has enough to illustrate " "some key concepts you'll need to know." msgstr "" +"我們將從一個 Tkinter 的 \"Hello World\" 應用程式開始。這不是我們能寫出的最小" +"程式,但足以說明一些你需要知道的關鍵概念。" #: ../../library/tkinter.rst:286 msgid "" @@ -569,6 +661,8 @@ msgid "" "also creates a toplevel window, known as the root window, which serves as " "the main window of the application." msgstr "" +"在引入之後,下一行建立了一個 :class:`Tk` 類別的實例,它會初始化 Tk 並建立其關" +"聯的 Tcl 直譯器。它還會建立一個頂層視窗,稱為根視窗,作為應用程式的主視窗。" #: ../../library/tkinter.rst:301 msgid "" @@ -576,6 +670,8 @@ msgid "" "label and a button we'll create next. The frame is fit inside the root " "window." msgstr "" +"接下來的一行建立了一個框架元件,在本例中,它將包含我們接下來要建立的一個標籤" +"和一個按鈕。該框架被放置在根視窗內。" #: ../../library/tkinter.rst:305 msgid "" @@ -583,30 +679,36 @@ msgid "" "`grid` method is used to specify the relative layout (position) of the label " "within its containing frame widget, similar to how tables in HTML work." msgstr "" +"下一行建立了一個包含靜態文字字串的標籤元件。:meth:`grid` 方法用於指定標籤在其" +"包含的框架元件中的相對佈局(位置),類似於 HTML 中表格的運作方式。" #: ../../library/tkinter.rst:309 msgid "" "A button widget is then created, and placed to the right of the label. When " "pressed, it will call the :meth:`destroy` method of the root window." msgstr "" +"然後建立一個按鈕元件,並放置在標籤的右側。當按下時,它將呼叫根視窗的 :meth:" +"`destroy` 方法。" #: ../../library/tkinter.rst:312 msgid "" "Finally, the :meth:`mainloop` method puts everything on the display, and " "responds to user input until the program terminates." msgstr "" +"最後,:meth:`mainloop` 方法將所有內容顯示在螢幕上,並回應使用者輸入,直到程式" +"終止。" #: ../../library/tkinter.rst:318 msgid "Important Tk Concepts" -msgstr "" +msgstr "重要的 Tk 概念" #: ../../library/tkinter.rst:320 msgid "Even this simple program illustrates the following key Tk concepts:" -msgstr "" +msgstr "即使是這個簡單的程式也說明了以下關鍵的 Tk 概念:" #: ../../library/tkinter.rst:322 msgid "widgets" -msgstr "" +msgstr "元件(widgets)" #: ../../library/tkinter.rst:323 msgid "" @@ -614,10 +716,13 @@ msgid "" "represented as a Python object, instantiated from classes like :class:`ttk." "Frame`, :class:`ttk.Label`, and :class:`ttk.Button`." msgstr "" +"一個 Tkinter 使用者介面是由個別的*元件*所組成。每個元件都表示為一個 Python 物" +"件,從 :class:`ttk.Frame`、:class:`ttk.Label` 和 :class:`ttk.Button` 等類別實" +"例化而來。" #: ../../library/tkinter.rst:327 msgid "widget hierarchy" -msgstr "" +msgstr "元件階層(widget hierarchy)" #: ../../library/tkinter.rst:328 msgid "" @@ -626,10 +731,12 @@ msgid "" "creating each *child* widget, its *parent* widget is passed as the first " "argument to the widget constructor." msgstr "" +"元件被安排在一個*階層*中。標籤和按鈕被包含在一個框架內,而框架又被包含在根視" +"窗內。在建立每個*子*元件時,其*父*元件會作為第一個引數傳遞給元件的建構函式。" #: ../../library/tkinter.rst:333 msgid "configuration options" -msgstr "" +msgstr "設定選項(configuration options)" #: ../../library/tkinter.rst:334 msgid "" @@ -637,10 +744,12 @@ msgid "" "behavior, such as the text to display in a label or button. Different " "classes of widgets will have different sets of options." msgstr "" +"元件具有*設定選項*,可以修改其外觀和行為,例如在標籤或按鈕中顯示的文字。不同" +"類別的元件會有不同的選項集。" #: ../../library/tkinter.rst:338 msgid "geometry management" -msgstr "" +msgstr "佈局管理(geometry management)" #: ../../library/tkinter.rst:339 msgid "" @@ -648,10 +757,12 @@ msgid "" "created. A *geometry manager* like ``grid`` controls where in the user " "interface they are placed." msgstr "" +"元件在建立時不會自動新增到使用者介面中。像 ``grid`` 這樣的*佈局管理器*會控制" +"它們在使用者介面中的放置位置。" #: ../../library/tkinter.rst:343 msgid "event loop" -msgstr "" +msgstr "事件迴圈(event loop)" #: ../../library/tkinter.rst:344 msgid "" @@ -659,10 +770,12 @@ msgid "" "the display only when actively running an *event loop*. If your program " "isn't running the event loop, your user interface won't update." msgstr "" +"Tkinter 只有在主動執行*事件迴圈*時,才會對使用者輸入、程式的變更,甚至螢幕刷" +"新做出反應。如果你的程式沒有執行事件迴圈,你的使用者介面將不會更新。" #: ../../library/tkinter.rst:350 msgid "Understanding How Tkinter Wraps Tcl/Tk" -msgstr "" +msgstr "了解 Tkinter 如何包裝 Tcl/Tk" #: ../../library/tkinter.rst:352 msgid "" @@ -671,6 +784,8 @@ msgid "" "commands in the Tcl interpreter attached to your application's :class:`Tk` " "instance." msgstr "" +"當你的應用程式使用 Tkinter 的類別和方法時,Tkinter 內部正在組合代表 Tcl/Tk 指" +"令的字串,並在附加到你應用程式 :class:`Tk` 實例的 Tcl 直譯器中執行這些指令。" #: ../../library/tkinter.rst:357 msgid "" @@ -679,12 +794,14 @@ msgid "" "Tkinter application, there are times that it will be useful to understand " "what those underlying Tcl/Tk commands look like." msgstr "" +"無論是試圖瀏覽參考文件、尋找正確的方法或選項、改寫一些現有程式碼,還是偵錯你" +"的 Tkinter 應用程式,在某些時候,了解那些底層 Tcl/Tk 指令的樣貌會很有幫助。" #: ../../library/tkinter.rst:362 msgid "" "To illustrate, here is the Tcl/Tk equivalent of the main part of the Tkinter " "script above." -msgstr "" +msgstr "為了說明,以下是上面 Tkinter 腳本主要部分的 Tcl/Tk 對等程式碼。" #: ../../library/tkinter.rst:367 msgid "" @@ -707,24 +824,28 @@ msgid "" "separated by spaces. Without getting into too many details, notice the " "following:" msgstr "" +"Tcl 的語法類似於許多 shell 語言,第一個字是要執行的指令,後面跟著該指令的引" +"數,以空格分隔。在不深入太多細節的情況下,請注意以下幾點:" #: ../../library/tkinter.rst:377 msgid "" "The commands used to create widgets (like ``ttk::frame``) correspond to " "widget classes in Tkinter." -msgstr "" +msgstr "用於建立元件的指令(如 ``ttk::frame``)對應於 Tkinter 中的元件類別。" #: ../../library/tkinter.rst:380 msgid "" "Tcl widget options (like ``-text``) correspond to keyword arguments in " "Tkinter." -msgstr "" +msgstr "Tcl 元件選項(如 ``-text``)對應於 Tkinter 中的關鍵字引數。" #: ../../library/tkinter.rst:383 msgid "" "Widgets are referred to by a *pathname* in Tcl (like ``.frm.btn``), whereas " "Tkinter doesn't use names but object references." msgstr "" +"在 Tcl 中,元件是透過*路徑名稱*(如 ``.frm.btn``)來參照,而 Tkinter 不使用名" +"稱,而是使用物件參照。" #: ../../library/tkinter.rst:386 msgid "" @@ -733,6 +854,9 @@ msgid "" "root window is just ``.`` (dot). In Tkinter, the hierarchy is defined not by " "pathname but by specifying the parent widget when creating each child widget." msgstr "" +"元件在元件階層中的位置被編碼在其(階層式)路徑名稱中,該路徑名稱使用 ``.``\\ " +"(點)作為路徑分隔符。根視窗的路徑名稱就是 ``.``\\ (點)。在 Tkinter 中,階" +"層不是由路徑名稱定義的,而是在建立每個子元件時指定父元件來定義的。" #: ../../library/tkinter.rst:392 msgid "" @@ -742,10 +866,13 @@ msgid "" "method calls on widget objects, which more closely mirror what would is used " "in Tkinter." msgstr "" +"在 Tcl 中實作為獨立*指令*的操作(如 ``grid`` 或 ``destroy``),在 Tkinter 中" +"則表示為元件物件上的*方法*。正如你稍後會看到的,在其他時候,Tcl 使用的看起來" +"像是對元件物件的方法呼叫,這更接近 Tkinter 中的用法。" #: ../../library/tkinter.rst:400 msgid "How do I...? What option does...?" -msgstr "" +msgstr "我該如何...?哪個選項可以...?" #: ../../library/tkinter.rst:402 msgid "" @@ -753,6 +880,8 @@ msgid "" "find it in the tutorial or reference documentation you're using, there are a " "few strategies that can be helpful." msgstr "" +"如果你不確定如何在 Tkinter 中做某件事,並且無法立即在你正在使用的教學或參考文" +"件中找到它,這裡有一些可能有幫助的策略。" #: ../../library/tkinter.rst:406 msgid "" @@ -761,6 +890,8 @@ msgid "" "documentation, make sure it corresponds to the Python and Tcl/Tk versions " "installed on your system." msgstr "" +"首先,請記住,個別元件的運作細節可能會因 Tkinter 和 Tcl/Tk 的不同版本而異。如" +"果你正在搜尋文件,請確保它對應於你系統上安裝的 Python 和 Tcl/Tk 版本。" #: ../../library/tkinter.rst:411 msgid "" @@ -769,6 +900,9 @@ msgid "" "interactive Python shell or with :func:`print`, can help you identify what " "you need." msgstr "" +"在搜尋如何使用 API 時,知道你正在使用的類別、選項或方法的確切名稱會很有幫助。" +"自省,無論是在互動式 Python shell 中還是使用 :func:`print`,都可以幫助你識別" +"所需內容。" #: ../../library/tkinter.rst:416 msgid "" @@ -777,6 +911,9 @@ msgid "" "variety of information about each object, including its default and current " "values. Use :meth:`keys` to get just the names of each option." msgstr "" +"要找出任何元件上有哪些可用的設定選項,請呼叫其 :meth:`configure` 方法,該方法" +"會回傳一個字典,其中包含有關每個物件的各種資訊,包括其預設值和目前值。使用 :" +"meth:`keys` 僅取得每個選項的名稱。" #: ../../library/tkinter.rst:423 msgid "" @@ -793,6 +930,8 @@ msgid "" "list of options to that of a simpler widget, like a frame, is one way to do " "that." msgstr "" +"由於大多數元件有許多共通的設定選項,找出特定於某個元件類別的選項會很有用。將" +"選項串列與像框架這樣較簡單的元件的選項串列進行比較,是做到這一點的一種方法。" #: ../../library/tkinter.rst:433 msgid "print(set(btn.configure().keys()) - set(frm.configure().keys()))" @@ -805,6 +944,9 @@ msgid "" "common widget methods, so again identifying those specific to a widget class " "is helpful." msgstr "" +"同樣地,你可以使用標準的 :func:`dir` 函式來尋找元件物件可用的方法。如果你試一" +"下,你會看到有超過 200 個常見的元件方法,所以再次強調,識別特定於某個元件類別" +"的方法是很有幫助的。" #: ../../library/tkinter.rst:442 msgid "" @@ -816,7 +958,7 @@ msgstr "" #: ../../library/tkinter.rst:447 msgid "Navigating the Tcl/Tk Reference Manual" -msgstr "" +msgstr "瀏覽 Tcl/Tk 參考手冊" #: ../../library/tkinter.rst:449 msgid "" @@ -826,6 +968,9 @@ msgid "" "the name of the option or method that you need, you may still have a few " "places to look." msgstr "" +"如前所述,官方的 `Tk 指令 `_ 參考手冊(man pages)通常是對元件上特定操作作用的最準確描述。即使你知" +"道所需選項或方法的名稱,你可能仍有幾個地方需要查看。" #: ../../library/tkinter.rst:454 msgid "" @@ -834,6 +979,9 @@ msgid "" "take a widget pathname as its first parameter, followed by optional " "parameters, e.g." msgstr "" +"雖然 Tkinter 中的所有操作都實作為對元件物件的方法呼叫,但你已經看到許多 Tcl/" +"Tk 操作顯示為指令,這些指令將元件路徑名稱作為其第一個參數,後面跟著可選的參" +"數,例如:" #: ../../library/tkinter.rst:461 msgid "" @@ -850,6 +998,9 @@ msgid "" "of the widget pathname, with the first parameter to that command being the " "name of a method to call)." msgstr "" +"然而,其他的看起來更像是對元件物件呼叫的方法(事實上,當你在 Tcl/Tk 中建立一" +"個元件時,它會建立一個以元件路徑名稱為名的 Tcl 指令,該指令的第一個參數是要呼" +"叫的方法名稱)。" #: ../../library/tkinter.rst:471 msgid "" @@ -868,6 +1019,11 @@ msgid "" "widget as a parameter often have their own man page (e.g., `grid `_)." msgstr "" +"在官方的 Tcl/Tk 參考文件中,你會在特定元件的 man page 上找到大多數看起來像方" +"法呼叫的操作(例如,你可以在 `ttk::button `_ man page 上找到 :meth:`invoke` 方法),而將元件作為參" +"數的函式通常有自己的 man page(例如 `grid `_)。" #: ../../library/tkinter.rst:483 msgid "" @@ -876,6 +1032,9 @@ msgid "" "tcl8.6/TkCmd/ttk_widget.htm>`_ man pages, while others are found in the man " "page for a specific widget class." msgstr "" +"你可以在 `options `_ 或 " +"`ttk::widget `_ man page " +"中找到許多常見的選項和方法,而其他的則在特定元件類別的 man page 中找到。" #: ../../library/tkinter.rst:488 msgid "" @@ -884,6 +1043,9 @@ msgid "" "documentation for all of these in the `winfo `_ man page." msgstr "" +"你還會發現許多 Tkinter 方法有複合名稱,例如 :func:`winfo_x`、:func:" +"`winfo_height`、:func:`winfo_viewable`。你可以在 `winfo `_ man page 中找到所有這些文件的說明。" #: ../../library/tkinter.rst:494 msgid "" @@ -893,16 +1055,22 @@ msgid "" "or the system bell. (They happen to be implemented as methods in the base :" "class:`Widget` class that all Tkinter widgets inherit from)." msgstr "" +"有點令人困惑的是,所有 Tkinter 元件上還有一些方法,它們實際上並不是對該元件進" +"行操作,而是在全域範圍內操作,獨立於任何元件。例如存取剪貼簿或系統鈴聲的方" +"法。(它們恰好被實作為所有 Tkinter 元件都繼承的基底 :class:`Widget` 類別中的" +"方法)。" #: ../../library/tkinter.rst:503 msgid "Threading model" -msgstr "" +msgstr "執行緒模型" #: ../../library/tkinter.rst:505 msgid "" "Python and Tcl/Tk have very different threading models, which :mod:`tkinter` " "tries to bridge. If you use threads, you may need to be aware of this." msgstr "" +"Python 和 Tcl/Tk 有非常不同的執行緒模型,:mod:`tkinter` 試圖彌合這種差異。如" +"果你使用執行緒,你可能需要意識到這一點。" #: ../../library/tkinter.rst:508 msgid "" @@ -912,6 +1080,9 @@ msgid "" "one interpreter instance, though each interpreter instance can be used only " "by the one thread that created it." msgstr "" +"一個 Python 直譯器可能有多個與之關聯的執行緒。在 Tcl 中,可以建立多個執行緒," +"但每個執行緒都有一個獨立的 Tcl 直譯器實例與之關聯。執行緒也可以建立多個直譯器" +"實例,但每個直譯器實例只能由建立它的那個執行緒使用。" #: ../../library/tkinter.rst:513 msgid "" @@ -922,6 +1093,10 @@ msgid "" "object, an event is posted to the interpreter's event queue, and when " "executed, the result is returned to the calling Python thread." msgstr "" +"由 :mod:`tkinter` 建立的每個 :class:`Tk` 物件都包含一個 Tcl 直譯器。它還會追" +"蹤是哪個執行緒建立了該直譯器。可以從任何 Python 執行緒呼叫 :mod:`tkinter`。在" +"內部,如果呼叫來自建立 :class:`Tk` 物件的執行緒以外的執行緒,則會將一個事件發" +"佈到直譯器的事件佇列中,執行後,結果會回傳給呼叫的 Python 執行緒。" #: ../../library/tkinter.rst:520 msgid "" @@ -935,6 +1110,12 @@ msgid "" "GUI runs in a completely separate thread from all application code including " "event handlers." msgstr "" +"Tcl/Tk 應用程式通常是事件驅動的,這意味著在初始化之後,直譯器會執行一個事件迴" +"圈(即 :func:`Tk.mainloop`)並回應事件。因為它是單執行緒的,事件處理常式必須" +"快速回應,否則它們會阻塞其他事件的處理。為避免這種情況,任何長時間執行的計算" +"都不應在事件處理常式中執行,而是使用計時器將其分解成更小的部分,或在另一個執" +"行緒中執行。這與許多 GUI 工具集不同,在那些工具集中,GUI 在一個與所有應用程式" +"碼(包括事件處理常式)完全分離的執行緒中執行。" #: ../../library/tkinter.rst:529 msgid "" @@ -942,10 +1123,12 @@ msgid "" "any :mod:`tkinter` calls made from threads other than the one running the " "Tcl interpreter will fail." msgstr "" +"如果 Tcl 直譯器沒有在執行事件迴圈和處理事件,那麼從執行 Tcl 直譯器的執行緒以" +"外的執行緒發出的任何 :mod:`tkinter` 呼叫都將失敗。" #: ../../library/tkinter.rst:533 msgid "A number of special cases exist:" -msgstr "" +msgstr "存在一些特殊情況:" #: ../../library/tkinter.rst:535 msgid "" @@ -954,6 +1137,9 @@ msgid "" "this is different than the thread that created the Tcl interpreter. A global " "lock ensures only one call occurs at a time." msgstr "" +"Tcl/Tk 函式庫可以被建構成不具備執行緒感知能力。在這種情況下,:mod:`tkinter` " +"會從原始的 Python 執行緒呼叫該函式庫,即使這與建立 Tcl 直譯器的執行緒不同。一" +"個全域鎖確保一次只發生一個呼叫。" #: ../../library/tkinter.rst:540 msgid "" @@ -964,6 +1150,10 @@ msgid "" "Otherwise, it's best to create them in separate threads and ensure you're " "running a thread-aware Tcl/Tk build." msgstr "" +"雖然 :mod:`tkinter` 允許你建立多個 :class:`Tk` 物件的實例(每個都有自己的直譯" +"器),但屬於同一個執行緒的所有直譯器共享一個共同的事件佇列,這很快就會變得混" +"亂。在實務上,不要一次建立多個 :class:`Tk` 的實例。否則,最好在不同的執行緒中" +"建立它們,並確保你正在執行一個具備執行緒感知能力的 Tcl/Tk 建構版本。" #: ../../library/tkinter.rst:546 msgid "" @@ -972,30 +1162,35 @@ msgid "" "event loops or abandon the event loop entirely. If you're doing anything " "tricky when it comes to events or threads, be aware of these possibilities." msgstr "" +"阻塞事件處理常式並不是防止 Tcl 直譯器重新進入事件迴圈的唯一方法。甚至可以執行" +"多個巢狀的事件迴圈或完全放棄事件迴圈。如果你在事件或執行緒方面做任何複雜的操" +"作,請注意這些可能性。" #: ../../library/tkinter.rst:551 msgid "" "There are a few select :mod:`tkinter` functions that presently work only " "when called from the thread that created the Tcl interpreter." msgstr "" +"目前有少數幾個 :mod:`tkinter` 函式只有在從建立 Tcl 直譯器的執行緒中呼叫時才能" +"正常運作。" #: ../../library/tkinter.rst:556 msgid "Handy Reference" -msgstr "" +msgstr "實用參考" #: ../../library/tkinter.rst:562 msgid "Setting Options" -msgstr "" +msgstr "設定選項" #: ../../library/tkinter.rst:564 msgid "" "Options control things like the color and border width of a widget. Options " "can be set in three ways:" -msgstr "" +msgstr "選項控制著諸如元件的顏色和邊框寬度等。選項可以透過三種方式設定:" #: ../../library/tkinter.rst:567 msgid "At object creation time, using keyword arguments" -msgstr "" +msgstr "在物件建立時,使用關鍵字引數" #: ../../library/tkinter.rst:570 msgid "fred = Button(self, fg=\"red\", bg=\"blue\")" @@ -1003,7 +1198,7 @@ msgstr "fred = Button(self, fg=\"red\", bg=\"blue\")" #: ../../library/tkinter.rst:572 msgid "After object creation, treating the option name like a dictionary index" -msgstr "" +msgstr "在物件建立後,將選項名稱視為字典索引" #: ../../library/tkinter.rst:575 msgid "" @@ -1017,7 +1212,7 @@ msgstr "" msgid "" "Use the config() method to update multiple attrs subsequent to object " "creation" -msgstr "" +msgstr "在物件建立後,使用 config() 方法更新多個屬性" #: ../../library/tkinter.rst:581 msgid "fred.config(fg=\"red\", bg=\"blue\")" @@ -1027,7 +1222,7 @@ msgstr "fred.config(fg=\"red\", bg=\"blue\")" msgid "" "For a complete explanation of a given option and its behavior, see the Tk " "man pages for the widget in question." -msgstr "" +msgstr "有關給定選項及其行為的完整解釋,請參閱相關元件的 Tk man pages。" #: ../../library/tkinter.rst:586 msgid "" @@ -1037,6 +1232,9 @@ msgid "" "particular widget. The Standard Options are documented on the :manpage:" "`options(3)` man page." msgstr "" +"請注意,man pages 為每個元件列出了「標準選項」和「元件特定選項」。前者是許多" +"元件共有的選項串列,後者是該特定元件特有的選項。標準選項記錄在 :manpage:" +"`options(3)` man page 中。" #: ../../library/tkinter.rst:592 msgid "" @@ -1045,6 +1243,9 @@ msgid "" "given widget responds to a particular option depends on the class of the " "widget; buttons have a ``command`` option, labels do not." msgstr "" +"本文件中未對標準選項和元件特定選項進行區分。某些選項不適用於某些類型的元件。" +"給定元件是否回應特定選項取決於該元件的類別;按鈕有 ``command`` 選項,標籤則沒" +"有。" #: ../../library/tkinter.rst:597 msgid "" @@ -1054,6 +1255,9 @@ msgid "" "The return value of these calls is a dictionary whose key is the name of the " "option as a string (for example, ``'relief'``) and whose values are 5-tuples." msgstr "" +"給定元件支援的選項列在該元件的 man page 中,或者可以在 runtime 透過不帶引數呼" +"叫 :meth:`config` 方法,或對該元件呼叫 :meth:`keys` 方法來查詢。這些呼叫的回" +"傳值是一個字典,其鍵是選項名稱的字串(例如 ``'relief'``),其值是 5-tuples。" #: ../../library/tkinter.rst:603 msgid "" @@ -1063,10 +1267,14 @@ msgid "" "tuple passed back will contain the name of the synonym and the \"real\" " "option (such as ``('bg', 'background')``)." msgstr "" +"某些選項,如 ``bg``,是具有長名稱的常見選項的同義詞(``bg`` 是 " +"\"background\" 的簡寫)。將簡寫選項的名稱傳遞給 ``config()`` 方法將回傳一個 " +"2-tuple,而不是 5-tuple。回傳的 2-tuple 將包含同義詞的名稱和「真實」選項(例" +"如 ``('bg', 'background')``)。" #: ../../library/tkinter.rst:610 msgid "Index" -msgstr "" +msgstr "索引" #: ../../library/tkinter.rst:610 msgid "Meaning" @@ -1082,7 +1290,7 @@ msgstr "0" #: ../../library/tkinter.rst:612 msgid "option name" -msgstr "" +msgstr "選項名稱" #: ../../library/tkinter.rst:612 ../../library/tkinter.rst:614 msgid "``'relief'``" @@ -1094,7 +1302,7 @@ msgstr "1" #: ../../library/tkinter.rst:614 msgid "option name for database lookup" -msgstr "" +msgstr "用於資料庫查詢的選項名稱" #: ../../library/tkinter.rst:616 msgid "2" @@ -1102,7 +1310,7 @@ msgstr "2" #: ../../library/tkinter.rst:616 msgid "option class for database lookup" -msgstr "" +msgstr "用於資料庫查詢的選項類別" #: ../../library/tkinter.rst:616 msgid "``'Relief'``" @@ -1114,7 +1322,7 @@ msgstr "3" #: ../../library/tkinter.rst:619 msgid "default value" -msgstr "" +msgstr "預設值" #: ../../library/tkinter.rst:619 msgid "``'raised'``" @@ -1126,7 +1334,7 @@ msgstr "4" #: ../../library/tkinter.rst:621 msgid "current value" -msgstr "" +msgstr "目前值" #: ../../library/tkinter.rst:621 msgid "``'groove'``" @@ -1148,11 +1356,11 @@ msgstr "" msgid "" "Of course, the dictionary printed will include all the options available and " "their values. This is meant only as an example." -msgstr "" +msgstr "當然,印出的字典將包含所有可用的選項及其值。這僅作為一個範例。" #: ../../library/tkinter.rst:634 msgid "The Packer" -msgstr "" +msgstr "Packer 佈局管理器" #: ../../library/tkinter.rst:638 msgid "" @@ -1164,6 +1372,10 @@ msgid "" "*filling*, etc - and works everything out to determine the exact placement " "coordinates for you." msgstr "" +"packer 是 Tk 的佈局管理機制之一。佈局管理器用於指定元件在其容器(它們共同的 " +"*master*\\ )內的相對位置。與較為繁瑣的 *placer*\\ (較不常用,我們在此不予介" +"紹)相比,packer 採用定性的關係規範——*上方*、*左方*、*填滿*\\ 等——並為你計算" +"出確切的放置座標。" #: ../../library/tkinter.rst:645 msgid "" @@ -1174,6 +1386,10 @@ msgid "" "you desire. Additionally, the arrangement is dynamically adjusted to " "accommodate incremental changes to the configuration, once it is packed." msgstr "" +"任何 *master* 元件的大小由其內部的「slave 元件」的大小決定。packer 用於控制 " +"slave 元件在被 packed 的 master 內部出現的位置。你可以將元件 pack 到框架中," +"再將框架 pack 到其他框架中,以達到你想要的佈局。此外,一旦 packed,佈局會動態" +"調整以適應設定的增量變更。" #: ../../library/tkinter.rst:652 msgid "" @@ -1183,6 +1399,9 @@ msgid "" "nothing appears. A widget will appear only after it has had, for example, " "the packer's :meth:`pack` method applied to it." msgstr "" +"請注意,元件在透過佈局管理器指定其佈局之前是不會出現的。一個常見的早期錯誤是" +"忽略了佈局指定,然後在元件被建立但沒有任何東西出現時感到驚訝。一個元件只有在" +"例如 packer 的 :meth:`pack` 方法被應用於其上之後才會出現。" #: ../../library/tkinter.rst:658 msgid "" @@ -1190,6 +1409,8 @@ msgid "" "where the widget is to appear within its container, and how it is to behave " "when the main application window is resized. Here are some examples::" msgstr "" +"pack() 方法可以與關鍵字選項/值對一起呼叫,以控制元件在其容器中出現的位置,以" +"及當主應用程式視窗調整大小時它的行為方式。以下是一些範例: ::" #: ../../library/tkinter.rst:662 msgid "" @@ -1197,71 +1418,76 @@ msgid "" "fred.pack(side=\"left\")\n" "fred.pack(expand=1)" msgstr "" +"fred.pack() # 預設為 side = \"top\"\n" +"fred.pack(side=\"left\")\n" +"fred.pack(expand=1)" #: ../../library/tkinter.rst:668 msgid "Packer Options" -msgstr "" +msgstr "Packer 選項" #: ../../library/tkinter.rst:670 msgid "" "For more extensive information on the packer and the options that it can " "take, see the man pages and page 183 of John Ousterhout's book." msgstr "" +"有關 packer 及其可接受選項的更詳盡資訊,請參閱 man pages 和 John Ousterhout " +"書中的第 183 頁。" #: ../../library/tkinter.rst:673 ../../library/tkinter.rst:792 msgid "anchor" -msgstr "" +msgstr "anchor" #: ../../library/tkinter.rst:674 msgid "" "Anchor type. Denotes where the packer is to place each slave in its parcel." -msgstr "" +msgstr "錨點類型。表示 packer 將每個 slave 放置在其區域中的位置。" #: ../../library/tkinter.rst:676 msgid "expand" -msgstr "" +msgstr "expand" #: ../../library/tkinter.rst:677 msgid "Boolean, ``0`` or ``1``." -msgstr "" +msgstr "布林值,``0`` 或 ``1``。" #: ../../library/tkinter.rst:679 msgid "fill" -msgstr "" +msgstr "fill" #: ../../library/tkinter.rst:680 msgid "Legal values: ``'x'``, ``'y'``, ``'both'``, ``'none'``." -msgstr "" +msgstr "合法值:``'x'``、``'y'``、``'both'``、``'none'``。" #: ../../library/tkinter.rst:682 msgid "ipadx and ipady" -msgstr "" +msgstr "ipadx 和 ipady" #: ../../library/tkinter.rst:683 msgid "" "A distance - designating internal padding on each side of the slave widget." -msgstr "" +msgstr "一個距離——指定 slave 元件每側的內部填充。" #: ../../library/tkinter.rst:685 msgid "padx and pady" -msgstr "" +msgstr "padx 和 pady" #: ../../library/tkinter.rst:686 msgid "" "A distance - designating external padding on each side of the slave widget." -msgstr "" +msgstr "一個距離——指定 slave 元件每側的外部填充。" #: ../../library/tkinter.rst:688 msgid "side" -msgstr "" +msgstr "side" #: ../../library/tkinter.rst:689 msgid "Legal values are: ``'left'``, ``'right'``, ``'top'``, ``'bottom'``." -msgstr "" +msgstr "合法值為:``'left'``、``'right'``、``'top'``、``'bottom'``。" #: ../../library/tkinter.rst:693 msgid "Coupling Widget Variables" -msgstr "" +msgstr "耦合元件變數" #: ../../library/tkinter.rst:695 msgid "" @@ -1272,6 +1498,10 @@ msgid "" "reason, the widget it's connected to will be updated to reflect the new " "value." msgstr "" +"某些元件(如文字輸入元件)的當前值設定可以透過使用特殊選項直接連接到應用程式" +"變數。這些選項是 ``variable``、``textvariable``、``onvalue``、``offvalue`` " +"和 ``value``。這種連接是雙向的:如果變數因任何原因發生變化,與之連接的元件將" +"會更新以反映新值。" #: ../../library/tkinter.rst:701 msgid "" @@ -1281,6 +1511,9 @@ msgid "" "which this works are variables that are subclassed from a class called " "Variable, defined in :mod:`tkinter`." msgstr "" +"不幸的是,在 :mod:`tkinter` 的目前實作中,無法透過 ``variable`` 或 " +"``textvariable`` 選項將任意的 Python 變數傳遞給元件。唯一適用此功能的變數類型" +"是從 :mod:`tkinter` 中定義的一個名為 Variable 的類別繼承的子類別變數。" #: ../../library/tkinter.rst:707 msgid "" @@ -1291,6 +1524,10 @@ msgid "" "this protocol, the widget will always track the value of the variable, with " "no further intervention on your part." msgstr "" +"已經定義了許多有用的 Variable 子類別::class:`StringVar`、:class:`IntVar`、:" +"class:`DoubleVar` 和 :class:`BooleanVar`。要讀取此類變數的目前值,請對其呼" +"叫 :meth:`get` 方法,要更改其值,則呼叫 :meth:`!set` 方法。如果你遵循此協定," +"元件將始終追蹤變數的值,無需你進一步干預。" #: ../../library/tkinter.rst:714 ../../library/tkinter.rst:894 msgid "For example::" @@ -1328,10 +1565,39 @@ msgid "" "myapp = App(root)\n" "myapp.mainloop()" msgstr "" +"import tkinter as tk\n" +"\n" +"class App(tk.Frame):\n" +" def __init__(self, master):\n" +" super().__init__(master)\n" +" self.pack()\n" +"\n" +" self.entrythingy = tk.Entry()\n" +" self.entrythingy.pack()\n" +"\n" +" # 建立應用程式變數。\n" +" self.contents = tk.StringVar()\n" +" # 將其設定為某個值。\n" +" self.contents.set(\"this is a variable\")\n" +" # 告訴 entry 元件監視此變數。\n" +" self.entrythingy[\"textvariable\"] = self.contents\n" +"\n" +" # 為使用者按下 return 鍵定義一個回呼。\n" +" # 它會印出變數的目前值。\n" +" self.entrythingy.bind('',\n" +" self.print_contents)\n" +"\n" +" def print_contents(self, event):\n" +" print(\"Hi. The current entry content is:\",\n" +" self.contents.get())\n" +"\n" +"root = tk.Tk()\n" +"myapp = App(root)\n" +"myapp.mainloop()" #: ../../library/tkinter.rst:747 msgid "The Window Manager" -msgstr "" +msgstr "視窗管理器" #: ../../library/tkinter.rst:751 msgid "" @@ -1342,6 +1608,10 @@ msgid "" "Toplevel widgets are subclassed from the :class:`Wm` class, and so can call " "the :class:`Wm` methods directly." msgstr "" +"在 Tk 中,有一個工具指令 ``wm``,用於與視窗管理器互動。``wm`` 指令的選項允許" +"你控制標題、位置、圖示點陣圖等。在 :mod:`tkinter` 中,這些指令已實作為 :" +"class:`Wm` 類別上的方法。頂層元件是 :class:`Wm` 類別的子類別,因此可以直接呼" +"叫 :class:`Wm` 方法。" #: ../../library/tkinter.rst:758 msgid "" @@ -1353,6 +1623,10 @@ msgid "" "fact that this function is part of the implementation, and not an interface " "to Tk functionality." msgstr "" +"要取得包含給定元件的頂層視窗,你通常可以直接參照該元件的 master。當然,如果該" +"元件被 packed 在一個框架內,master 將不代表一個頂層視窗。要取得包含任意元件的" +"頂層視窗,你可以呼叫 :meth:`_root` 方法。此方法以底線開頭,表示此函式是實作的" +"一部分,而不是 Tk 功能的介面。" #: ../../library/tkinter.rst:765 msgid "Here are some examples of typical usage::" @@ -1379,10 +1653,28 @@ msgid "" "# start the program\n" "myapp.mainloop()" msgstr "" +"import tkinter as tk\n" +"\n" +"class App(tk.Frame):\n" +" def __init__(self, master=None):\n" +" super().__init__(master)\n" +" self.pack()\n" +"\n" +"# 建立應用程式\n" +"myapp = App()\n" +"\n" +"#\n" +"# 以下是對視窗管理器類別的方法呼叫\n" +"#\n" +"myapp.master.title(\"My Do-Nothing Application\")\n" +"myapp.master.maxsize(1000, 400)\n" +"\n" +"# 啟動程式\n" +"myapp.mainloop()" #: ../../library/tkinter.rst:788 ../../library/tkinter.rst:790 msgid "Tk Option Data Types" -msgstr "" +msgstr "Tk 選項資料型別" #: ../../library/tkinter.rst:793 msgid "" @@ -1390,10 +1682,12 @@ msgid "" "``\"se\"``, ``\"s\"``, ``\"sw\"``, ``\"w\"``, ``\"nw\"``, and also " "``\"center\"``." msgstr "" +"合法值為羅盤方位點:``\"n\"``、``\"ne\"``、``\"e\"``、``\"se\"``、``\"s\"``、" +"``\"sw\"``、``\"w\"``、``\"nw\"``,以及 ``\"center\"``。" #: ../../library/tkinter.rst:796 msgid "bitmap" -msgstr "" +msgstr "bitmap" #: ../../library/tkinter.rst:797 msgid "" @@ -1402,22 +1696,26 @@ msgid "" "``'warning'``. To specify an X bitmap filename, give the full path to the " "file, preceded with an ``@``, as in ``\"@/usr/contrib/bitmap/gumby.bit\"``." msgstr "" +"有八個內建的、命名的點陣圖:``'error'``、``'gray25'``、``'gray50'``、" +"``'hourglass'``、``'info'``、``'questhead'``、``'question'``、``'warning'``。" +"要指定一個 X 點陣圖檔名,請給出檔案的完整路徑,並在前面加上一個 ``@``,例如 " +"``\"@/usr/contrib/bitmap/gumby.bit\"``。" #: ../../library/tkinter.rst:802 msgid "boolean" -msgstr "" +msgstr "boolean" #: ../../library/tkinter.rst:803 msgid "You can pass integers 0 or 1 or the strings ``\"yes\"`` or ``\"no\"``." -msgstr "" +msgstr "你可以傳遞整數 0 或 1,或字串 ``\"yes\"`` 或 ``\"no\"``。" #: ../../library/tkinter.rst:805 msgid "callback" -msgstr "" +msgstr "callback" #: ../../library/tkinter.rst:806 msgid "This is any Python function that takes no arguments. For example::" -msgstr "" +msgstr "這是任何不帶引數的 Python 函式。例如: ::" #: ../../library/tkinter.rst:808 msgid "" @@ -1431,7 +1729,7 @@ msgstr "" #: ../../library/tkinter.rst:812 msgid "color" -msgstr "" +msgstr "color" #: ../../library/tkinter.rst:813 msgid "" @@ -1441,10 +1739,14 @@ msgid "" "``\"#RRRRGGGGBBBB\"`` ranges, where R,G,B here represent any legal hex " "digit. See page 160 of Ousterhout's book for details." msgstr "" +"顏色可以以 rgb.txt 檔案中的 X 顏色名稱給出,或以表示 RGB 值的字串給出,範圍可" +"以是 4 位元:``\"#RGB\"``、8 位元:``\"#RRGGBB\"``、12 位元:" +"``\"#RRRGGGBBB\"`` 或 16 位元:``\"#RRRRGGGGBBBB\"``,其中 R、G、B 在此代表任" +"何合法的十六進位數字。詳情請參閱 Ousterhout 書中的第 160 頁。" #: ../../library/tkinter.rst:818 msgid "cursor" -msgstr "" +msgstr "cursor" #: ../../library/tkinter.rst:819 msgid "" @@ -1453,10 +1755,13 @@ msgid "" "use the string ``\"hand2\"``. You can also specify a bitmap and mask file " "of your own. See page 179 of Ousterhout's book." msgstr "" +"可以使用 :file:`cursorfont.h` 中的標準 X 游標名稱,無需 ``XC_`` 前綴。例如," +"要取得手形游標(:const:`XC_hand2`),請使用字串 ``\"hand2\"``。你也可以指定自" +"己的點陣圖和遮罩檔案。請參閱 Ousterhout 書中的第 179 頁。" #: ../../library/tkinter.rst:824 msgid "distance" -msgstr "" +msgstr "distance" #: ../../library/tkinter.rst:825 msgid "" @@ -1466,10 +1771,13 @@ msgid "" "``m`` for millimetres, ``p`` for printer's points. For example, 3.5 inches " "is expressed as ``\"3.5i\"``." msgstr "" +"螢幕距離可以以像素或絕對距離指定。像素以數字給出,絕對距離以字串給出,尾隨字" +"元表示單位:``c`` 代表公分,``i`` 代表英寸,``m`` 代表毫米,``p`` 代表印表機" +"的點。例如,3.5 英寸表示為 ``\"3.5i\"``。" #: ../../library/tkinter.rst:831 msgid "font" -msgstr "" +msgstr "font" #: ../../library/tkinter.rst:832 msgid "" @@ -1477,10 +1785,12 @@ msgid "" "with positive numbers are measured in points; sizes with negative numbers " "are measured in pixels." msgstr "" +"Tk 使用串列字型名稱格式,例如 ``{courier 10 bold}``。帶有正數的字型大小以點為" +"單位;帶有負數的大小以像素為單位。" #: ../../library/tkinter.rst:836 msgid "geometry" -msgstr "" +msgstr "geometry" #: ../../library/tkinter.rst:837 msgid "" @@ -1488,20 +1798,24 @@ msgid "" "measured in pixels for most widgets (in characters for widgets displaying " "text). For example: ``fred[\"geometry\"] = \"200x100\"``." msgstr "" +"這是一個 ``widthxheight`` 形式的字串,其中 width 和 height 對於大多數元件是以" +"像素為單位(對於顯示文字的元件則以字元為單位)。例如:``fred[\"geometry\"] = " +"\"200x100\"``。" #: ../../library/tkinter.rst:841 msgid "justify" -msgstr "" +msgstr "justify" #: ../../library/tkinter.rst:842 msgid "" "Legal values are the strings: ``\"left\"``, ``\"center\"``, ``\"right\"``, " "and ``\"fill\"``." msgstr "" +"合法值為字串:``\"left\"``、``\"center\"``、``\"right\"`` 和 ``\"fill\"``。" #: ../../library/tkinter.rst:845 msgid "region" -msgstr "" +msgstr "region" #: ../../library/tkinter.rst:846 msgid "" @@ -1509,10 +1823,13 @@ msgid "" "legal distance (see above). For example: ``\"2 3 4 5\"`` and ``\"3i 2i 4.5i " "2i\"`` and ``\"3c 2c 4c 10.43c\"`` are all legal regions." msgstr "" +"這是一個由四個以空格分隔的元素組成的字串,每個元素都是一個合法的距離(見上" +"文)。例如:``\"2 3 4 5\"``、``\"3i 2i 4.5i 2i\"`` 和 ``\"3c 2c 4c " +"10.43c\"`` 都是合法的區域。" #: ../../library/tkinter.rst:850 msgid "relief" -msgstr "" +msgstr "relief" #: ../../library/tkinter.rst:851 msgid "" @@ -1520,28 +1837,32 @@ msgid "" "``\"raised\"``, ``\"sunken\"``, ``\"flat\"``, ``\"groove\"``, and " "``\"ridge\"``." msgstr "" +"決定元件的邊框樣式。合法值為:``\"raised\"``、``\"sunken\"``、``\"flat\"``、" +"``\"groove\"`` 和 ``\"ridge\"``。" #: ../../library/tkinter.rst:854 msgid "scrollcommand" -msgstr "" +msgstr "scrollcommand" #: ../../library/tkinter.rst:855 msgid "" "This is almost always the :meth:`!set` method of some scrollbar widget, but " "can be any widget method that takes a single argument." msgstr "" +"這幾乎總是某個捲軸元件的 :meth:`!set` 方法,但也可以是任何接受單一引數的元件" +"方法。" #: ../../library/tkinter.rst:858 msgid "wrap" -msgstr "" +msgstr "wrap" #: ../../library/tkinter.rst:859 msgid "Must be one of: ``\"none\"``, ``\"char\"``, or ``\"word\"``." -msgstr "" +msgstr "必須是以下之一:``\"none\"``、``\"char\"`` 或 ``\"word\"``。" #: ../../library/tkinter.rst:864 msgid "Bindings and Events" -msgstr "" +msgstr "綁定與事件" #: ../../library/tkinter.rst:870 msgid "" @@ -1549,6 +1870,8 @@ msgid "" "events and to have a callback function trigger when that event type occurs. " "The form of the bind method is::" msgstr "" +"來自元件指令的 bind 方法允許你監視某些事件,並在該事件類型發生時觸發一個回呼" +"函式。bind 方法的形式是: ::" #: ../../library/tkinter.rst:874 msgid "def bind(self, sequence, func, add=''):" @@ -1556,11 +1879,11 @@ msgstr "def bind(self, sequence, func, add=''):" #: ../../library/tkinter.rst:876 msgid "where:" -msgstr "" +msgstr "其中:" #: ../../library/tkinter.rst:878 msgid "sequence" -msgstr "sequence(序列)" +msgstr "sequence" #: ../../library/tkinter.rst:879 msgid "" @@ -1568,10 +1891,13 @@ msgid "" "`bind(3tk)` man page, and page 201 of John Ousterhout's book, :title-" "reference:`Tcl and the Tk Toolkit (2nd edition)`, for details)." msgstr "" +"是一個表示目標事件類型的字串。(詳情請參閱 :manpage:`bind(3tk)` man page,以" +"及 John Ousterhout 的書 :title-reference:`Tcl and the Tk Toolkit (2nd " +"edition)` 的第 201 頁)。" #: ../../library/tkinter.rst:883 msgid "func" -msgstr "" +msgstr "func" #: ../../library/tkinter.rst:884 msgid "" @@ -1579,10 +1905,12 @@ msgid "" "occurs. An Event instance will be passed as the argument. (Functions " "deployed this way are commonly known as *callbacks*.)" msgstr "" +"是一個 Python 函式,接受一個引數,在事件發生時被呼叫。一個 Event 實例將作為引" +"數傳遞。(以這種方式部署的函式通常稱為*回呼*。)" #: ../../library/tkinter.rst:888 msgid "add" -msgstr "" +msgstr "add" #: ../../library/tkinter.rst:889 msgid "" @@ -1591,6 +1919,9 @@ msgid "" "with. Passing a ``'+'`` means that this function is to be added to the list " "of functions bound to this event type." msgstr "" +"是可選的,可以是 ``''`` 或 ``'+'``。傳遞一個空字串表示此綁定將取代與此事件關" +"聯的任何其他綁定。傳遞一個 ``'+'`` 意味著此函式將被新增到綁定到此事件類型的函" +"式串列中。" #: ../../library/tkinter.rst:896 msgid "" @@ -1612,10 +1943,13 @@ msgid "" "how they are denoted in Tk, which can be useful when referring to the Tk man " "pages." msgstr "" +"請注意在 ``turn_red()`` 回呼中如何存取事件的 widget 欄位。此欄位包含捕獲 X 事" +"件的元件。下表列出了你可以存取的其他事件欄位,以及它們在 Tk 中的表示方式,這" +"在參閱 Tk man pages 時可能很有用。" #: ../../library/tkinter.rst:907 msgid "Tkinter Event Field" -msgstr "" +msgstr "Tkinter 事件欄位" #: ../../library/tkinter.rst:909 msgid "%f" @@ -1623,7 +1957,7 @@ msgstr "%f" #: ../../library/tkinter.rst:909 msgid "focus" -msgstr "" +msgstr "focus" #: ../../library/tkinter.rst:909 msgid "%A" @@ -1639,7 +1973,7 @@ msgstr "%h" #: ../../library/tkinter.rst:911 msgid "height" -msgstr "" +msgstr "height" #: ../../library/tkinter.rst:911 msgid "%E" @@ -1655,7 +1989,7 @@ msgstr "%k" #: ../../library/tkinter.rst:913 msgid "keycode" -msgstr "" +msgstr "keycode" #: ../../library/tkinter.rst:913 msgid "%K" @@ -1663,7 +1997,7 @@ msgstr "%K" #: ../../library/tkinter.rst:913 msgid "keysym" -msgstr "" +msgstr "keysym" #: ../../library/tkinter.rst:915 msgid "%s" @@ -1671,7 +2005,7 @@ msgstr "%s" #: ../../library/tkinter.rst:915 msgid "state" -msgstr "" +msgstr "state" #: ../../library/tkinter.rst:915 msgid "%N" @@ -1687,7 +2021,7 @@ msgstr "%t" #: ../../library/tkinter.rst:917 msgid "time" -msgstr "" +msgstr "time" #: ../../library/tkinter.rst:917 msgid "%T" @@ -1695,7 +2029,7 @@ msgstr "%T" #: ../../library/tkinter.rst:917 msgid "type" -msgstr "" +msgstr "type" #: ../../library/tkinter.rst:919 msgid "%w" @@ -1703,7 +2037,7 @@ msgstr "%w" #: ../../library/tkinter.rst:919 msgid "width" -msgstr "" +msgstr "width" #: ../../library/tkinter.rst:919 msgid "%W" @@ -1711,7 +2045,7 @@ msgstr "%W" #: ../../library/tkinter.rst:919 msgid "widget" -msgstr "" +msgstr "widget" #: ../../library/tkinter.rst:921 msgid "%x" @@ -1747,7 +2081,7 @@ msgstr "y_root" #: ../../library/tkinter.rst:928 msgid "The index Parameter" -msgstr "" +msgstr "index 參數" #: ../../library/tkinter.rst:930 msgid "" @@ -1755,10 +2089,12 @@ msgid "" "used to point at a specific place in a Text widget, or to particular " "characters in an Entry widget, or to particular menu items in a Menu widget." msgstr "" +"許多元件需要傳遞 \"index\" 參數。這些參數用於指向 Text 元件中的特定位置、" +"Entry 元件中的特定字元,或 Menu 元件中的特定選單項目。" #: ../../library/tkinter.rst:934 msgid "Entry widget indexes (index, view index, etc.)" -msgstr "" +msgstr "Entry 元件索引(index、view index 等)" #: ../../library/tkinter.rst:935 msgid "" @@ -1766,54 +2102,62 @@ msgid "" "being displayed. You can use these :mod:`tkinter` functions to access these " "special points in text widgets:" msgstr "" +"Entry 元件具有參照所顯示文字中字元位置的選項。你可以使用這些 :mod:`tkinter` " +"函式來存取文字元件中的這些特殊點:" #: ../../library/tkinter.rst:939 msgid "Text widget indexes" -msgstr "" +msgstr "Text 元件索引" #: ../../library/tkinter.rst:940 msgid "" "The index notation for Text widgets is very rich and is best described in " "the Tk man pages." -msgstr "" +msgstr "Text 元件的索引表示法非常豐富,在 Tk man pages 中有最好的描述。" #: ../../library/tkinter.rst:943 msgid "Menu indexes (menu.invoke(), menu.entryconfig(), etc.)" -msgstr "" +msgstr "選單索引(menu.invoke()、menu.entryconfig() 等)" #: ../../library/tkinter.rst:944 msgid "" "Some options and methods for menus manipulate specific menu entries. Anytime " "a menu index is needed for an option or a parameter, you may pass in:" msgstr "" +"選單的某些選項和方法會操作特定的選單項目。每當選項或參數需要選單索引時,你可" +"以傳入:" #: ../../library/tkinter.rst:947 msgid "" "an integer which refers to the numeric position of the entry in the widget, " "counted from the top, starting with 0;" -msgstr "" +msgstr "一個整數,它參照元件中項目的數字位置,從頂部開始計數,從 0 開始;" #: ../../library/tkinter.rst:950 msgid "" "the string ``\"active\"``, which refers to the menu position that is " "currently under the cursor;" -msgstr "" +msgstr "字串 ``\"active\"``,它參照目前在游標下的選單位置;" #: ../../library/tkinter.rst:953 msgid "the string ``\"last\"`` which refers to the last menu item;" -msgstr "" +msgstr "字串 ``\"last\"``,它參照最後一個選單項目;" #: ../../library/tkinter.rst:955 msgid "" "An integer preceded by ``@``, as in ``@6``, where the integer is interpreted " "as a y pixel coordinate in the menu's coordinate system;" msgstr "" +"一個以 ``@`` 為前綴的整數,如 ``@6``,其中該整數被解釋為選單座標系統中的 y 像" +"素座標;" #: ../../library/tkinter.rst:958 msgid "" "the string ``\"none\"``, which indicates no menu entry at all, most often " "used with menu.activate() to deactivate all entries, and finally," msgstr "" +"字串 ``\"none\"``,表示完全沒有選單項目,最常用於 menu.activate() 以停用所有" +"項目,最後," #: ../../library/tkinter.rst:961 msgid "" @@ -1823,32 +2167,38 @@ msgid "" "items labelled ``last``, ``active``, or ``none`` may be interpreted as the " "above literals, instead." msgstr "" +"一個文字字串,它會與從選單頂部掃描到底部的選單項目標籤進行模式匹配。請注意," +"此索引類型在所有其他類型之後考慮,這意味著標籤為 ``last``、``active`` 或 " +"``none`` 的選單項目的匹配可能會被解釋為上述的字面值。" #: ../../library/tkinter.rst:969 msgid "Images" -msgstr "" +msgstr "圖片" #: ../../library/tkinter.rst:971 msgid "" "Images of different formats can be created through the corresponding " "subclass of :class:`tkinter.Image`:" -msgstr "" +msgstr "可以透過 :class:`tkinter.Image` 的相應子類別來建立不同格式的圖片:" #: ../../library/tkinter.rst:974 msgid ":class:`BitmapImage` for images in XBM format." -msgstr "" +msgstr ":class:`BitmapImage` 用於 XBM 格式的圖片。" #: ../../library/tkinter.rst:976 msgid "" ":class:`PhotoImage` for images in PGM, PPM, GIF and PNG formats. The latter " "is supported starting with Tk 8.6." msgstr "" +":class:`PhotoImage` 用於 PGM、PPM、GIF 和 PNG 格式的圖片。後者從 Tk 8.6 開始" +"支援。" #: ../../library/tkinter.rst:979 msgid "" "Either type of image is created through either the ``file`` or the ``data`` " "option (other options are available as well)." msgstr "" +"任一類型的圖片都是透過 ``file`` 或 ``data`` 選項建立的(也有其他選項可用)。" #: ../../library/tkinter.rst:982 msgid "" @@ -1858,6 +2208,11 @@ msgid "" "meth:`!copy`, :meth:`!zoom` and :meth:`!subsample`. Add *zoom* and " "*subsample* parameters to :class:`!PhotoImage` method :meth:`!copy`." msgstr "" +"新增了 :class:`!PhotoImage` 方法 :meth:`!copy_replace`,用於將一個區域從一個" +"圖片複製到另一個圖片,可能帶有像素縮放和/或子採樣。將 *from_coords* 參數新增" +"到 :class:`!PhotoImage` 方法 :meth:`!copy`、:meth:`!zoom` 和 :meth:`!" +"subsample`。將 *zoom* 和 *subsample* 參數新增到 :class:`!PhotoImage` 方法 :" +"meth:`!copy`。" #: ../../library/tkinter.rst:991 msgid "" @@ -1867,16 +2222,21 @@ msgid "" "object is deleted, the image data is deleted as well, and Tk will display an " "empty box wherever the image was used." msgstr "" +"然後,圖片物件可以在任何支援 ``image`` 選項的元件(例如標籤、按鈕、選單)中使" +"用。在這些情況下,Tk 將不會保留對圖片的參照。當對圖片物件的最後一個 Python 參" +"照被刪除時,圖片資料也會被刪除,Tk 將在使用該圖片的任何地方顯示一個空框。" #: ../../library/tkinter.rst:999 msgid "" "The `Pillow `_ package adds support for formats " "such as BMP, JPEG, TIFF, and WebP, among others." msgstr "" +"`Pillow `_ 套件新增了對 BMP、JPEG、TIFF 和 WebP " +"等格式的支援。" #: ../../library/tkinter.rst:1005 msgid "File Handlers" -msgstr "" +msgstr "檔案處理常式" #: ../../library/tkinter.rst:1007 msgid "" @@ -1884,6 +2244,8 @@ msgid "" "called from the Tk mainloop when I/O is possible on a file descriptor. Only " "one handler may be registered per file descriptor. Example code::" msgstr "" +"Tk 允許你註冊和取消註冊一個回呼函式,當檔案描述符上可以進行 I/O 時,該函式將" +"從 Tk 主迴圈中被呼叫。每個檔案描述符只能註冊一個處理常式。範例程式碼: ::" #: ../../library/tkinter.rst:1011 msgid "" @@ -1903,7 +2265,7 @@ msgstr "" #: ../../library/tkinter.rst:1018 msgid "This feature is not available on Windows." -msgstr "" +msgstr "此功能在 Windows 上不可用。" #: ../../library/tkinter.rst:1020 msgid "" @@ -1915,6 +2277,12 @@ msgid "" "work fine; for other files, use raw reads or ``os.read(file.fileno(), " "maxbytecount)``." msgstr "" +"由於你不知道有多少位元組可供讀取,你可能不想使用 :class:`~io.BufferedIOBase` " +"或 :class:`~io.TextIOBase` 的 :meth:`~io.BufferedIOBase.read` 或 :meth:`~io." +"IOBase.readline` 方法,因為這些方法會堅持讀取預定義數量的位元組。對於 sockets" +"(通訊端),:meth:`~socket.socket.recv` 或 :meth:`~socket.socket.recvfrom` 方" +"法可以正常運作;對於其他檔案,請使用原始讀取或 ``os.read(file.fileno(), " +"maxbytecount)``。" #: ../../library/tkinter.rst:1031 msgid "" @@ -1924,6 +2292,10 @@ msgid "" "ORed combination of any of the three constants below. The callback is called " "as follows::" msgstr "" +"註冊檔案處理常式回呼函式 *func*。*file* 引數可以是一個具有 :meth:`~io.IOBase." +"fileno` 方法的物件(例如檔案或 socket(通訊端)物件),或是一個整數檔案描述" +"符。*mask* 引數是下面三個常數中任意一個的 OR 組合。回呼函式被呼叫的方式如" +"下: ::" #: ../../library/tkinter.rst:1037 msgid "callback(file, mask)" @@ -1931,27 +2303,27 @@ msgstr "callback(file, mask)" #: ../../library/tkinter.rst:1042 msgid "Unregisters a file handler." -msgstr "" +msgstr "取消註冊檔案處理常式。" #: ../../library/tkinter.rst:1049 msgid "Constants used in the *mask* arguments." -msgstr "" +msgstr "用於 *mask* 引數的常數。" #: ../../library/tkinter.rst:636 msgid "packing (widgets)" -msgstr "" +msgstr "packing(元件)" #: ../../library/tkinter.rst:749 msgid "window manager (widgets)" -msgstr "" +msgstr "視窗管理器(元件)" #: ../../library/tkinter.rst:866 msgid "bind (widgets)" -msgstr "" +msgstr "bind(元件)" #: ../../library/tkinter.rst:866 msgid "events (widgets)" -msgstr "" +msgstr "事件(元件)" #~ msgid ":mod:`tkinter.tix`" #~ msgstr ":mod:`tkinter.tix`" pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy