Idiots guide to fonts with tKinter

Discussion in 'Python' started by import newbie, Aug 4, 2005.

  1. Hi all,

    I'm a programming dabbler trying learn Python, and I've got a few
    questions.

    Mainly: Where can I find a good open-source library or tutorial
    (preferably free) that explains how to easily manipulate text in a
    tKinter window? Basically, I want to be able to do anything that HTML
    can do (or close to it) but without the HTML. :)

    My "newbie dream project" is to piece together a functional, WYSIWYG
    text editor that can handle at least three fonts: Times New Roman,
    Arial and Courier (bold, italics and underlined).

    I know, I know. That's pretty ambitious. But that's my goal for Python.
    So....what's the easiest way to get there? What steps should I take?
    I'm not in any rush, I just want some help along the way...
     
    import newbie, Aug 4, 2005
    #1
    1. Advertising

  2. import newbie

    RangerElf Guest

    Well, all text classes in Tkinter can take a " font=(...) " argument to
    specify the face with which to display, for example:

    from tkinter import *
    .....
    label = Label(root, font=("Helvetica", "bold", 13), ...)


    It's been a while since I've played with Tkinter, so I might be a
    little off on the exact syntax, but that's the main idea. It's really
    simple once you get the hang of it.

    Regarding the text editor: it's an excellent idea. By using Tkinter's
    text widget you can get a bit of milage easily; you'll have to define
    and use "tags" in order to organize your text styles, it'll make
    everything quite a bit easier.

    You can glean a bunch of info from Idle's sources.

    Good luck :)

    -gus
     
    RangerElf, Aug 5, 2005
    #2
    1. Advertising

  3. import newbie

    James Stroud Guest

    No doubt you have found Fredrik Lundh's intro:

    http://www.pythonware.com/library/tkinter/introduction/

    You can get a long way with that and experimenting.

    Also, check out Tk:

    http://www.astro.princeton.edu/~rhl/Tcl-Tk_docs/tk8.0a1/contents.html

    If you can figure out how to translate the Tk documentation into Tkinter, you
    open a lot of doors for yourself.

    The best easily available Tkinter tutorial I have found is in the Programming
    Python book by Mark Lutz (O'Reilly):

    http://www.oreilly.com/catalog/python2/toc.html

    Its $55 bucks, but is full of good examples, so it is worth it. The price of
    course is not the money, but the fact that some parts of the book (not
    necessarily the Tkinter part) can get pretty tedious to work through. But its
    worth the investment in time and money. I don't recommend learning Tkinter
    with just a reference manual (like Lundh's page).

    You'll waste far more money's worth of time than just $55 trying to figure out
    how to do things that are already clearly described in Programming Python.

    James

    On Thursday 04 August 2005 02:02 am, import newbie wrote:
    > Hi all,
    >
    > I'm a programming dabbler trying learn Python, and I've got a few
    > questions.
    >
    > Mainly: Where can I find a good open-source library or tutorial
    > (preferably free) that explains how to easily manipulate text in a
    > tKinter window? Basically, I want to be able to do anything that HTML
    > can do (or close to it) but without the HTML. :)
    >
    > My "newbie dream project" is to piece together a functional, WYSIWYG
    > text editor that can handle at least three fonts: Times New Roman,
    > Arial and Courier (bold, italics and underlined).
    >
    > I know, I know. That's pretty ambitious. But that's my goal for Python.
    > So....what's the easiest way to get there? What steps should I take?
    > I'm not in any rush, I just want some help along the way...


    --
    James Stroud
    UCLA-DOE Institute for Genomics and Proteomics
    Box 951570
    Los Angeles, CA 90095

    http://www.jamesstroud.com/
     
    James Stroud, Aug 5, 2005
    #3
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. R2G2

    Idiots guide to divs?

    R2G2, May 20, 2005, in forum: HTML
    Replies:
    5
    Views:
    723
    Toby Inkster
    May 20, 2005
  2. CBFalconer

    The nerve of some idiots!

    CBFalconer, Feb 25, 2007, in forum: C Programming
    Replies:
    17
    Views:
    565
    Bob Martin
    Feb 27, 2007
  3. mark | r

    Req: idiots guide to a simple product list

    mark | r, Aug 11, 2005, in forum: ASP General
    Replies:
    3
    Views:
    141
    Aaron Bertrand [SQL Server MVP]
    Aug 12, 2005
  4. Xah Lee
    Replies:
    16
    Views:
    330
    Albert van der Horst
    Mar 12, 2012
  5. Xah Lee
    Replies:
    15
    Views:
    726
    Albert van der Horst
    Mar 12, 2012
Loading...

Share This Page