T

Tcl, Tk as GUI extension 210 test coverage, needed for porting 275, 279 TestCase class assert_ 271

assertAlmostEqual 271 assertEqual 271 assertFalse 271 assertNotAlmostEqual 271 assertNotEqual 271 assertRaises 271 fail 271

unittest class 270 testing 265-273 assert statement 266 avoiding doctest traps 269 doctests 267-270 need for 266 unit tests 270-273 with Python 2.6 and -3 276 TestLoader class 272 TestRunner class 272 TestSuite class 272 unittest class 270

Text (widget) in Tkinter 221 text file, analyzing, example program 101 text input, prompting for

(raw_input) 163 third-party modules 123 title function 72 Tk, GUI extension of Tcl 210 Tkinter 209-221 advantages 210 alternatives to 221 cross-platform support 210 direct mapping of Tk widgets to Python classes 212 event handling in 220 example application 214-215 Frame (widget class) 214 geometry management for 213 grid command 217 grid geometry manager 214 GUI development library for

Python 209 installing 210

integration into Python 210 mouse events in 220 named attributes 212 default values 213 pack geometry manager 214 place geometry manager 214 principles 212-214 quick development time 210 rowconfigure

(command) 218 sources of further information 219 Tk interface module 211 Toplevel (widget class) 214 ttk widgets 210 using classes to manage 219 virtual events in 220 widgets 212 attributes 215 Button 219 Canvas 221

constructor arguments 213 creating 215 hierarchy 215 Label 219 parent 216 placement 214-218 relative placement 217 Scrollbar orientation 218

Tkinter (continued)

placement 217 sticky attributes for 218 Text 221 window events in 220 Tkinter package 107 Toplevel (widget class) in

Tkinter 214 tracebacks 38

True (Boolean value) 26, 99 try statement 28, 179 try-except statement 179 try-except-finally-else statement 28 try-finally statement (finalizer) 206 ttk widget set in Tkinter 210 tuple (conversion function) 23, 73

converting list to tuple 60 tuples 22, 57-60 as dictionary keys 22 as keys for dictionaries 87 concatenating (+) 57 converting to lists 23, 60 copying 58 creating (=) 57 element types 22 immutability of 57 index notation 57 methods 22

one-element, comma in 58 packing and unpacking 59-60 with list delimiters 60 parentheses and 58 reading from a file

(pickle.load) 167 unpacking of, in for loops 94 unpacking to make for loops cleaner 94 unpacking, extended (*) 59 writing to a file

(pickle.dump) 168 TurboGears 295 type (type finding function) 242 type coercions 38 type conversions any Python object to a string

(repr, str) 74 integer to float (float) 40 string to float (float, string.atof) 69 typed list 252 TypedList 252, 267

types as objects 242-246

built-in, subclassing 254-256

bytes 275

checking 243

comparing 243

duck-typing 245

in the standard library 283

obtaining the class of an object ( __class__ ) 244 of user-defined classes 243 type objects 243 typing, dynamic 8

Was this article helpful?

0 0

Post a comment