[Tutor] Change Font Size when print to screen

Alan Gauld alan.gauld at btinternet.com
Tue Jan 11 18:51:00 CET 2011


"tee chwee liong" <tcl76 at hotmail.com> wrote

> When I do print "Hello World", it will print to the cmd window
> with the standard font size. Is there a way we can increase
> the font size to larger when print out to the cmd window?

If you want to control appearance other than bold/flashing/underline
and color then your best bet is to create a minimal GUI app with just
a Text widget and control the fonts etc there.

But you will need to get familiar with the GUI toolkits to do that.

A basic app in Tkinter can be found in my tutorial in the event
driven programming topic. It looks like this:

########################
from Tkinter import *

class KeysApp(Frame):
    def __init__(self): # use constructor to build GUI
        Frame.__init__(self)
        self.txtBox = Text(self)
        self.txtBox.bind("<space>", self.doQuitEvent)
        self.txtBox.pack()
        self.pack()

    def doQuitEvent(self,event):
        import sys
        sys.exit()


# Now create an instance and start the event loop running
myApp = KeysApp()
myApp.mainloop()
###########################

As you see its a lot more work that a print!

If you want to read user input you can use the standard dialog
boxes or EasyGUI. You might want a button to start your code executing 
too.
For that see my GUI topic...

HTH,


-- 
Alan Gauld
Author of the Learn to Program web site
http://www.alan-g.me.uk/






More information about the Tutor mailing list