473,651 Members | 2,582 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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 2489
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=("Helvetic a", "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
5968
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 filling the remainder of the window. Mind you, this is a contrived test application to help me understand Tkinter and Python, not an actual application yet. I've trivially subclassed Tkinter.Canvas into ColorCanvas, added a bunch of ColorCanvases...
4
21166
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 that info is in some file or files somewhere, buy I don't know the file name or directory. Thanks, Mitchell Timin
1
1710
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 embedded system Im working on, nothing seems to work,
0
3578
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 accordingly. However, what I really want to happen is that the area of the canvas that the scrollbars show (the Scrollregion) should expand as the window grows. It doesn't currently do this. although, if the window shrinks smaller than the...
3
1610
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 updated with a drop down list of product categories, but dont know how that translates into asp? mark
9
1234
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 with litle things but i have a big problem. the CLASS method. when i seperate things up into classes i carnt get one class to tell the other class somthing. it just opens another coppy of the class. i am confused.
1
3249
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. However, I cannot use the font in a python app that I am writing. The list returned by Tkfont.families does not contain this particular font. Any suggestions ?
1
3595
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 I am hoping someone knows what I am doing wrong: 1) Pressing the Settings.. Button multiple times, brings up many instances of the Settings Panel. I just want it to bring up one. Is there an easy way to do that?
0
1299
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. Secondly, can I set font globally (or specify "default" font for widgets)? In fact, all I want is to get default OS font unless (rarely) I need to specify another. Thanks
0
8275
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
1
8457
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8571
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
7294
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
6157
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 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 a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5605
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4280
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2696
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
1
1905
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.