Newbie : Greek letters

asdf sdf asdf at asdf.com
Fri May 7 01:41:09 EDT 2004


You reminded me that I would find this handy myself so I set up a 
program to display greek letters.  Pay no attention to the sizer 
handling.  Working on that.

sorry if the mailer munges the linewrapping.  shouldn't be a biggie in 
a script this small.

good luck.

#
# greek.py
#

import wx
import string

class Greek(wx.Frame):
     ''' greek alphabet '''

     alphabet = string.ascii_letters

     def __init__ (self, parent, id, title):
         wx.Frame.__init__(self, parent, id, title)

         # wx.Font(points, family, style, weight, face='')
         romanfont = wx.Font(16, wx.DEFAULT, wx.NORMAL, wx.NORMAL)
         greekfont = wx.Font(16, wx.DEFAULT, wx.NORMAL, wx.NORMAL, 
face='SYMBOL')

         gs = wx.GridSizer(-1, 10, 5, 5)

         roman = []
         greek = []

         textstyle = wx.ALIGN_CENTER|wx.ST_NO_AUTORESIZE
         cellstyle = wx.EXPAND

         for x in range(len(Greek.alphabet)):
             letter = Greek.alphabet[x]

             roman.append(wx.StaticText(self, -1, letter
                 ,wx.Point(-1,-1), wx.Size(-1,-1), textstyle))
             roman[x].SetFont(romanfont)
             roman[x].SetBackgroundColour('Yellow')

             greek.append(wx.StaticText(self, -1, letter
                 ,wx.Point(-1,-1), wx.Size(-1,-1), textstyle))
             greek[x].SetFont(greekfont)
             greek[x].SetBackgroundColour('White')

             gs.Add(roman[x], 1, cellstyle, 10)
             gs.Add(greek[x], 1, cellstyle, 10)

         # layout sizers
         self.SetSizer(gs)
         self.SetAutoLayout(1)
         gs.Fit(self)

         self.Show(True)

app = wx.PySimpleApp()
frame = Greek(None, -1, 'Greek Alphabet')

app.MainLoop()

# -------------------------------------
# greek.py - end of file
# -------------------------------------



More information about the Python-list mailing list