A Font Selection Application
This chapter concludes with an example that lets you select fonts. It is written as a dialog that you can add to your application. The menus are tied to elements of the font array that are used in font configure commands. The actual settings of the font are shown above a sampler of what the font looks like. When the user clicks the OK button, the font configuration is returned:
Example 39-4 Font selection dialog.
proc Font_Select {{top .fontsel}} { global font # Create File, Font, Size, and Format menus toplevel $top -class Fontsel -bd 10 set menubar [menu $top.menubar] $top config -menu $menubar foreach x {File Font ... |
Get Practical Programming in Tcl & Tk, Third Edition now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.