[Python-checkins] r69055 - in python/branches/py3k: Demo/tkinter/README Demo/tkinter/ttk Demo/tkinter/ttk/combo_themes.py Demo/tkinter/ttk/dirbrowser.py Demo/tkinter/ttk/listbox_scrollcmd.py Demo/tkinter/ttk/mac_searchentry.py Demo/tkinter/ttk/notebook_closebtn.py Demo/tkinter/ttk/plastik_theme.py Demo/tkinter/ttk/roundframe.py Demo/tkinter/ttk/theme_selector.py Demo/tkinter/ttk/treeview_multicolumn.py Demo/tkinter/ttk/ttkcalendar.py Demo/tkinter/ttk/widget_state.py Misc/NEWS
guilherme.polo
python-checkins at python.org
Wed Jan 28 17:06:52 CET 2009
Author: guilherme.polo
Date: Wed Jan 28 17:06:51 2009
New Revision: 69055
Log:
Merged revisions 69053 via svnmerge from
svn+ssh://pythondev/python/trunk
........
r69053 | guilherme.polo | 2009-01-28 13:56:01 -0200 (Wed, 28 Jan 2009) | 2 lines
Demos for ttk added.
........
Added:
python/branches/py3k/Demo/tkinter/ttk/
- copied from r69053, /python/trunk/Demo/tkinter/ttk/
Modified:
python/branches/py3k/ (props changed)
python/branches/py3k/Demo/tkinter/README
python/branches/py3k/Demo/tkinter/ttk/combo_themes.py
python/branches/py3k/Demo/tkinter/ttk/dirbrowser.py
python/branches/py3k/Demo/tkinter/ttk/listbox_scrollcmd.py
python/branches/py3k/Demo/tkinter/ttk/mac_searchentry.py
python/branches/py3k/Demo/tkinter/ttk/notebook_closebtn.py
python/branches/py3k/Demo/tkinter/ttk/plastik_theme.py
python/branches/py3k/Demo/tkinter/ttk/roundframe.py
python/branches/py3k/Demo/tkinter/ttk/theme_selector.py
python/branches/py3k/Demo/tkinter/ttk/treeview_multicolumn.py
python/branches/py3k/Demo/tkinter/ttk/ttkcalendar.py
python/branches/py3k/Demo/tkinter/ttk/widget_state.py
python/branches/py3k/Misc/NEWS
Modified: python/branches/py3k/Demo/tkinter/README
==============================================================================
--- python/branches/py3k/Demo/tkinter/README (original)
+++ python/branches/py3k/Demo/tkinter/README Wed Jan 28 17:06:51 2009
@@ -8,3 +8,4 @@
guido my original example set (fairly random collection)
matt Matt Conway's examples, to go with his lifesaver document
+ttk Examples using the ttk module
Modified: python/branches/py3k/Demo/tkinter/ttk/combo_themes.py
==============================================================================
--- /python/trunk/Demo/tkinter/ttk/combo_themes.py (original)
+++ python/branches/py3k/Demo/tkinter/ttk/combo_themes.py Wed Jan 28 17:06:51 2009
@@ -3,7 +3,7 @@
Although it is a theme selector, you won't notice many changes since
there is only a combobox and a frame around.
"""
-import ttk
+from tkinter import ttk
class App(ttk.Frame):
def __init__(self):
Modified: python/branches/py3k/Demo/tkinter/ttk/dirbrowser.py
==============================================================================
--- /python/trunk/Demo/tkinter/ttk/dirbrowser.py (original)
+++ python/branches/py3k/Demo/tkinter/ttk/dirbrowser.py Wed Jan 28 17:06:51 2009
@@ -4,8 +4,8 @@
"""
import os
import glob
-import Tkinter
-import ttk
+import tkinter
+from tkinter import ttk
def populate_tree(tree, node):
if tree.set(node, "type") != 'directory':
@@ -63,7 +63,7 @@
sbar.grid()
sbar.set(first, last)
-root = Tkinter.Tk()
+root = tkinter.Tk()
vsb = ttk.Scrollbar(orient="vertical")
hsb = ttk.Scrollbar(orient="horizontal")
Modified: python/branches/py3k/Demo/tkinter/ttk/listbox_scrollcmd.py
==============================================================================
--- /python/trunk/Demo/tkinter/ttk/listbox_scrollcmd.py (original)
+++ python/branches/py3k/Demo/tkinter/ttk/listbox_scrollcmd.py Wed Jan 28 17:06:51 2009
@@ -10,12 +10,12 @@
.l insert end "Line $i of 100"
}
"""
-import Tkinter
-import ttk
+import tkinter
+from tkinter import ttk
-root = Tkinter.Tk()
+root = tkinter.Tk()
-l = Tkinter.Listbox(height=5)
+l = tkinter.Listbox(height=5)
l.grid(column=0, row=0, sticky='nwes')
s = ttk.Scrollbar(command=l.yview, orient='vertical')
Modified: python/branches/py3k/Demo/tkinter/ttk/mac_searchentry.py
==============================================================================
--- /python/trunk/Demo/tkinter/ttk/mac_searchentry.py (original)
+++ python/branches/py3k/Demo/tkinter/ttk/mac_searchentry.py Wed Jan 28 17:06:51 2009
@@ -2,10 +2,10 @@
Translated from Tcl code by Schelte Bron, http://wiki.tcl.tk/18188
"""
-import Tkinter
-import ttk
+import tkinter
+from tkinter import ttk
-root = Tkinter.Tk()
+root = tkinter.Tk()
data = """
R0lGODlhKgAaAOfnAFdZVllbWFpcWVtdWlxeW11fXF9hXmBiX2ZnZWhpZ2lraGxua25wbXJ0
@@ -49,8 +49,8 @@
RRRWENHwRQEBADs="""
-s1 = Tkinter.PhotoImage("search1", data=data, format="gif -index 0")
-s2 = Tkinter.PhotoImage("search2", data=data, format="gif -index 1")
+s1 = tkinter.PhotoImage("search1", data=data, format="gif -index 0")
+s2 = tkinter.PhotoImage("search2", data=data, format="gif -index 1")
style = ttk.Style()
Modified: python/branches/py3k/Demo/tkinter/ttk/notebook_closebtn.py
==============================================================================
--- /python/trunk/Demo/tkinter/ttk/notebook_closebtn.py (original)
+++ python/branches/py3k/Demo/tkinter/ttk/notebook_closebtn.py Wed Jan 28 17:06:51 2009
@@ -3,16 +3,16 @@
Based on an example by patthoyts, http://paste.tclers.tk/896
"""
import os
-import Tkinter
-import ttk
+import tkinter
+from tkinter import ttk
-root = Tkinter.Tk()
+root = tkinter.Tk()
imgdir = os.path.join(os.path.dirname(__file__), 'img')
-i1 = Tkinter.PhotoImage("img_close", file=os.path.join(imgdir, 'close.gif'))
-i2 = Tkinter.PhotoImage("img_closeactive",
+i1 = tkinter.PhotoImage("img_close", file=os.path.join(imgdir, 'close.gif'))
+i2 = tkinter.PhotoImage("img_closeactive",
file=os.path.join(imgdir, 'close_active.gif'))
-i3 = Tkinter.PhotoImage("img_closepressed",
+i3 = tkinter.PhotoImage("img_closepressed",
file=os.path.join(imgdir, 'close_pressed.gif'))
style = ttk.Style()
@@ -67,9 +67,9 @@
# create a ttk notebook with our custom style, and add some tabs to it
nb = ttk.Notebook(width=200, height=200, style="ButtonNotebook")
nb.pressed_index = None
-f1 = Tkinter.Frame(nb, background="red")
-f2 = Tkinter.Frame(nb, background="green")
-f3 = Tkinter.Frame(nb, background="blue")
+f1 = tkinter.Frame(nb, background="red")
+f2 = tkinter.Frame(nb, background="green")
+f3 = tkinter.Frame(nb, background="blue")
nb.add(f1, text='Red', padding=3)
nb.add(f2, text='Green', padding=3)
nb.add(f3, text='Blue', padding=3)
Modified: python/branches/py3k/Demo/tkinter/ttk/plastik_theme.py
==============================================================================
--- /python/trunk/Demo/tkinter/ttk/plastik_theme.py (original)
+++ python/branches/py3k/Demo/tkinter/ttk/plastik_theme.py Wed Jan 28 17:06:51 2009
@@ -21,8 +21,7 @@
"""
import os
import glob
-import ttk
-from Tkinter import PhotoImage
+from tkinter import ttk, PhotoImage
__all__ = ['install']
Modified: python/branches/py3k/Demo/tkinter/ttk/roundframe.py
==============================================================================
--- /python/trunk/Demo/tkinter/ttk/roundframe.py (original)
+++ python/branches/py3k/Demo/tkinter/ttk/roundframe.py Wed Jan 28 17:06:51 2009
@@ -1,12 +1,12 @@
"""Ttk Frame with rounded corners.
Based on an example by Bryan Oakley, found at: http://wiki.tcl.tk/20152"""
-import Tkinter
-import ttk
+import tkinter
+from tkinter import ttk
-root = Tkinter.Tk()
+root = tkinter.Tk()
-img1 = Tkinter.PhotoImage("frameFocusBorder", data="""
+img1 = tkinter.PhotoImage("frameFocusBorder", data="""
R0lGODlhQABAAPcAAHx+fMTCxKSipOTi5JSSlNTS1LSytPTy9IyKjMzKzKyq
rOzq7JyanNza3Ly6vPz6/ISChMTGxKSmpOTm5JSWlNTW1LS2tPT29IyOjMzO
zKyurOzu7JyenNze3Ly+vPz+/OkAKOUA5IEAEnwAAACuQACUAAFBAAB+AFYd
@@ -46,7 +46,7 @@
bbDABAN00EADFRRQ++2254777rr3jrvjFTTQwQCpz7u6QRut5/oEzA/g/PPQ
Ry/99NIz//oGrZpUUEAAOw==""")
-img2 = Tkinter.PhotoImage("frameBorder", data="""
+img2 = tkinter.PhotoImage("frameBorder", data="""
R0lGODlhQABAAPcAAHx+fMTCxKSipOTi5JSSlNTS1LSytPTy9IyKjMzKzKyq
rOzq7JyanNza3Ly6vPz6/ISChMTGxKSmpOTm5JSWlNTW1LS2tPT29IyOjMzO
zKyurOzu7JyenNze3Ly+vPz+/OkAKOUA5IEAEnwAAACuQACUAAFBAAB+AFYd
@@ -103,7 +103,7 @@
entry.bind("<FocusIn>", lambda evt: frame.state(["focus"]))
entry.bind("<FocusOut>", lambda evt: frame.state(["!focus"]))
-text = Tkinter.Text(frame2, borderwidth=0, bg="white", highlightthickness=0)
+text = tkinter.Text(frame2, borderwidth=0, bg="white", highlightthickness=0)
text.pack(fill='both', expand=1)
text.bind("<FocusIn>", lambda evt: frame2.state(["focus"]))
text.bind("<FocusOut>", lambda evt: frame2.state(["!focus"]))
Modified: python/branches/py3k/Demo/tkinter/ttk/theme_selector.py
==============================================================================
--- /python/trunk/Demo/tkinter/ttk/theme_selector.py (original)
+++ python/branches/py3k/Demo/tkinter/ttk/theme_selector.py Wed Jan 28 17:06:51 2009
@@ -4,8 +4,8 @@
since now you can notice theme changes in Ttk Combobox, Ttk Frame,
Ttk Label and Ttk Button.
"""
-import Tkinter
-import ttk
+import tkinter
+from tkinter import ttk
class App(ttk.Frame):
def __init__(self):
@@ -15,7 +15,7 @@
# XXX Ideally I wouldn't want to create a Tkinter.IntVar to make
# it works with Checkbutton variable option.
- self.theme_autochange = Tkinter.IntVar(self, 0)
+ self.theme_autochange = tkinter.IntVar(self, 0)
self._setup_widgets()
def _change_theme(self):
Modified: python/branches/py3k/Demo/tkinter/ttk/treeview_multicolumn.py
==============================================================================
--- /python/trunk/Demo/tkinter/ttk/treeview_multicolumn.py (original)
+++ python/branches/py3k/Demo/tkinter/ttk/treeview_multicolumn.py Wed Jan 28 17:06:51 2009
@@ -1,7 +1,7 @@
"""Demo based on the demo mclist included with tk source distribution."""
-import Tkinter
-import tkFont
-import ttk
+import tkinter
+import tkinter.font
+from tkinter import ttk
tree_columns = ("country", "capital", "currency")
tree_data = [
@@ -77,19 +77,19 @@
command=lambda c=col: sortby(self.tree, c, 0))
# XXX tkFont.Font().measure expected args are incorrect according
# to the Tk docs
- self.tree.column(col, width=tkFont.Font().measure(col.title()))
+ self.tree.column(col, width=tkinter.font.Font().measure(col.title()))
for item in tree_data:
self.tree.insert('', 'end', values=item)
# adjust columns lenghts if necessary
for indx, val in enumerate(item):
- ilen = tkFont.Font().measure(val)
+ ilen = tkinter.font.Font().measure(val)
if self.tree.column(tree_columns[indx], width=None) < ilen:
self.tree.column(tree_columns[indx], width=ilen)
def main():
- root = Tkinter.Tk()
+ root = tkinter.Tk()
root.wm_title("Multi-Column List")
root.wm_iconname("mclist")
Modified: python/branches/py3k/Demo/tkinter/ttk/ttkcalendar.py
==============================================================================
--- /python/trunk/Demo/tkinter/ttk/ttkcalendar.py (original)
+++ python/branches/py3k/Demo/tkinter/ttk/ttkcalendar.py Wed Jan 28 17:06:51 2009
@@ -3,9 +3,9 @@
classes.
"""
import calendar
-import Tkinter
-import tkFont
-import ttk
+import tkinter
+import tkinter.font
+from tkinter import ttk
def get_calendar(locale, fwday):
# instantiate proper calendar class
@@ -109,15 +109,15 @@
self._calendar.tag_configure('header', background='grey90')
self._calendar.insert('', 'end', values=cols, tag='header')
# adjust its columns width
- font = tkFont.Font()
+ font = tkinter.font.Font()
maxwidth = max(font.measure(col) for col in cols)
for col in cols:
self._calendar.column(col, width=maxwidth, minwidth=maxwidth,
anchor='e')
def __setup_selection(self, sel_bg, sel_fg):
- self._font = tkFont.Font()
- self._canvas = canvas = Tkinter.Canvas(self._calendar,
+ self._font = tkinter.font.Font()
+ self._canvas = canvas = tkinter.Canvas(self._calendar,
background=sel_bg, borderwidth=0, highlightthickness=0)
canvas.text = canvas.create_text(0, 0, fill=sel_fg, anchor='w')
@@ -216,7 +216,7 @@
def test():
import sys
- root = Tkinter.Tk()
+ root = tkinter.Tk()
root.title('Ttk Calendar')
ttkcal = Calendar(firstweekday=calendar.SUNDAY)
ttkcal.pack(expand=1, fill='both')
Modified: python/branches/py3k/Demo/tkinter/ttk/widget_state.py
==============================================================================
--- /python/trunk/Demo/tkinter/ttk/widget_state.py (original)
+++ python/branches/py3k/Demo/tkinter/ttk/widget_state.py Wed Jan 28 17:06:51 2009
@@ -1,5 +1,5 @@
"""Sample demo showing widget states and some font styling."""
-import ttk
+from tkinter import ttk
states = ['active', 'disabled', 'focus', 'pressed', 'selected',
'background', 'readonly', 'alternate', 'invalid']
Modified: python/branches/py3k/Misc/NEWS
==============================================================================
--- python/branches/py3k/Misc/NEWS (original)
+++ python/branches/py3k/Misc/NEWS Wed Jan 28 17:06:51 2009
@@ -351,6 +351,8 @@
Tools/Demos
-----------
+- Ttk demos added in Demo/tkinter/ttk/
+
- Issue #4677: add two list comprehension tests to pybench.
More information about the Python-checkins
mailing list