summaryrefslogtreecommitdiff
path: root/Doc/library/tkinter.rst
diff options
context:
space:
mode:
authorMartin v. L?wis <martin@v.loewis.de>2012-04-20 14:37:17 +0200
committerMartin v. L?wis <martin@v.loewis.de>2012-04-20 14:37:17 +0200
commitb467205669cae187c9bbce311069c4875518bfae (patch)
treece7686f020917e8883d1818b8fadece2cc15fa06 /Doc/library/tkinter.rst
parentf235cad91035d648e09ae7a1867fc9aa49ae8963 (diff)
parent2c826ad61cf991d15646ae7bfac2d0cb34535cd8 (diff)
downloadcpython-b467205669cae187c9bbce311069c4875518bfae.tar.gz
merge 3.2: issue 14629
Diffstat (limited to 'Doc/library/tkinter.rst')
-rw-r--r--Doc/library/tkinter.rst64
1 files changed, 34 insertions, 30 deletions
diff --git a/Doc/library/tkinter.rst b/Doc/library/tkinter.rst
index ae5635f3c8..2e3583614f 100644
--- a/Doc/library/tkinter.rst
+++ b/Doc/library/tkinter.rst
@@ -179,35 +179,30 @@ A Simple Hello World Program
::
- from tkinter import *
-
- class Application(Frame):
- def say_hi(self):
- print("hi there, everyone!")
-
- def createWidgets(self):
- self.QUIT = Button(self)
- self.QUIT["text"] = "QUIT"
- self.QUIT["fg"] = "red"
- self.QUIT["command"] = self.quit
+ import tkinter as tk
- self.QUIT.pack({"side": "left"})
+ class Application(tk.Frame):
+ def __init__(self, master=None):
+ tk.Frame.__init__(self, master)
+ self.pack()
+ self.createWidgets()
- self.hi_there = Button(self)
- self.hi_there["text"] = "Hello",
- self.hi_there["command"] = self.say_hi
+ def createWidgets(self):
+ self.hi_there = tk.Button(self)
+ self.hi_there["text"] = "Hello World\n(click me)"
+ self.hi_there["command"] = self.say_hi
+ self.hi_there.pack(side="top")
- self.hi_there.pack({"side": "left"})
+ self.QUIT = tk.Button(self, text="QUIT", fg="red",
+ command=root.destroy)
+ self.QUIT.pack(side="bottom")
- def __init__(self, master=None):
- Frame.__init__(self, master)
- self.pack()
- self.createWidgets()
+ def say_hi(self):
+ print("hi there, everyone!")
- root = Tk()
- app = Application(master=root)
- app.mainloop()
- root.destroy()
+ root = tk.Tk()
+ app = Application(master=root)
+ app.mainloop()
A (Very) Quick Look at Tcl/Tk
@@ -740,22 +735,32 @@ Entry widget indexes (index, view index, etc.)
displayed. You can use these :mod:`tkinter` functions to access these special
points in text widgets:
- AtEnd()
+.. function:: AtEnd()
refers to the last position in the text
- AtInsert()
+ .. deprecated:: 3.3
+
+.. function:: AtInsert()
refers to the point where the text cursor is
- AtSelFirst()
+ .. deprecated:: 3.3
+
+.. function:: AtSelFirst()
indicates the beginning point of the selected text
- AtSelLast()
+ .. deprecated:: 3.3
+
+.. function:: AtSelLast()
denotes the last point of the selected text and finally
- At(x[, y])
+ .. deprecated:: 3.3
+
+.. function:: At(x[, y])
refers to the character at pixel location *x*, *y* (with *y* not used in the
case of a text entry widget, which contains a single line of text).
+ .. deprecated:: 3.3
+
Text widget indexes
The index notation for Text widgets is very rich and is best described in the Tk
man pages.
@@ -803,4 +808,3 @@ some widget (e.g. labels, buttons, menus). In these cases, Tk will not keep a
reference to the image. When the last Python reference to the image object is
deleted, the image data is deleted as well, and Tk will display an empty box
wherever the image was used.
-