473,379 Members | 1,330 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,379 software developers and data experts.

Idiots guide to fonts with tKinter

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...

Aug 4 '05 #1
2 2464
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

Aug 5 '05 #2
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/.../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/
Aug 5 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: Josh | last post by:
Caution, newbie approaching... I'm trying to come up with a very simple Tkinter test application that consists of a window with a drop-down menu bar at the top and a grid of colored rectangles...
4
by: SeeBelow | last post by:
I'm learning Tkinter, from Grayson's book and some online sources. I don't know how to find out which color names and font names are available on my system. I'm using Windows 2000. I assume...
1
by: phil | last post by:
I'm cpmpletely lost on fonts. I'm using Tkinter I do medarial = '-*-Arial-Bold-*-*--24-*-*-*-ISO8859-1" or Courier or Fixed in various sizes. Works great on my RH 7.2 But a small...
0
by: syed_saqib_ali | last post by:
Below is a simple code snippet showing a Tkinter Window bearing a canvas and 2 connected scrollbars (Vertical & Horizontal). Works fine. When you shrink/resize the window the scrollbars adjust...
3
by: mark | r | last post by:
im lookinf for an idiots guide to creating a product list where categories are stored in a separate table from the products table, i know how to link the data in access so the products table is...
9
by: Jay | last post by:
I have compleated the beginers guide to python http://www.freenetpages.co.uk/hp/alan.gauld/. then i found the Toolkit Tkinter and started on that. its graight and av made lots of apps to help me...
1
by: Atul | last post by:
Hi, I have installed a truetype font (.ttf) on a linux machne (SUSE linux 10, KDE) by copying it to my .fonts folder. I can use the font in all applications like open-office and firefox browser....
1
by: Michael Yanowitz | last post by:
Hello: Below I have included a stripped down version of the GUI I am working on. It contains 2 dialog boxes - one main and one settings. It has the following problems, probably all related, that...
0
by: Unnamed One | last post by:
First question - is it possible to set font to default OS font for window text? It would be preferable, while on my Windows XP system Tkinter sets small Helvetica-style font by default. ...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.