I need help on the use of Classes. I am trying to use the Font class in Python
to create my own instance. Erro is no Font! I though Font was a standard class in Python.

Any help for a newbie will be appreciated.

from Tkinter import * 

class myStuff(Font):
    def __init__(self):
        item = myStuff.families()
        for each x in item
            print x

Font is not part of the bread and butter console version of Python. Any of the GUI toolkits and PyGame make fonts available.

Here is an example using the Tkinter GUI toolkit that normally comes with Python ...

import Tkinter as tk

# create mainwindow
root = tk.Tk()

mytext = " Hello, world! "
myfont = ('times', 48, 'bold')
# create a label showing mytext using myfont
# red characters on yellow background
label = tk.Label(root, text=mytext, font=myfont, fg='red', bg='yellow')
# position the label

# start the event loop

There is a class Font in tkFont.py look at ...

import tkFont
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.