1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107
|
#--- modules ---
import tkMessageBox, tkSimpleDialog, tkFileDialog, string
import os.path, glob, sys
import Tkinter as tk
import ScrolledText
from datetime import date
# from Tkconstants import LEFT, RIGHT, TOP, BOTTOM, END, Y
# sys.stdout = open('my_stdout.log', 'w')
# sys.stderr = open('my_stderr.log', 'w')
#--- classes ---
class uiClass:
# used once for main GUI
# create a menu object tied to the root parent
def __init__ (self,master,ar,xy,flex):
# create the main GUI window with its menu object
self.frame = tk.Toplevel (relief='ridge', borderwidth=2)
# sets its size and location
self.frame.geometry (ar+xy)
# (dis)allow resize horiz/vertical
self.frame.resizable (flex,flex)
# widgets
btn_exp = tk.Button (self.frame,
text = 'Expediteur',
width=20, bd=4,
command = () )
btn_exp.grid (row=1, column=1, sticky=tk.N, padx=5 )
btn_date = tk.Button (self.frame,
text='date',
width=10, bd=4,
command = () )
btn_date.grid (row=1, column=4, sticky=tk.NE , padx=20 )
btn_dest = tk.Button (self.frame,
text='Destinataire',
width=20, bd=4,
command= () )
btn_dest.grid (row=2, column=1, sticky=tk.N, padx=5 )
btn_suj = tk.Button (self.frame,
text = 'Sujet / Ref.',
width=20, bd=4,
command = ())
btn_suj.grid (row=3, column=1, sticky=tk.N, padx=5 )
# champs
ch_exp = tk.Text (self.frame,
width='35', height='5',
font=('Arial',10,'normal'))
ch_exp.configure (bg='ivory')
ch_exp.grid (row=1, column=2, sticky=tk.N )
scroll_exp = tk.Scrollbar ( self.frame, orient = tk.VERTICAL )
scroll_exp.config (command = ch_exp.yview )
ch_exp ['yscrollcommand'] = scroll_exp.set
scroll_exp.grid (row=1, column=3, sticky=tk.S+tk.N )
ch_date = tk.Text (self.frame,
width = '30', height='1',
font = ( 'Arial',10,'normal') )
ch_date.configure (bg='ivory')
ch_date.grid (row=1, column=5, sticky=tk.N )
ch_dest = tk.Text ( self.frame,
width='35', height='5',
font=('Arial',10,'normal') )
ch_dest.configure ( bg='ivory' )
ch_dest.grid ( row=2, column=2, sticky=tk.N )
scroll_dest = tk.Scrollbar ( self.frame, orient = tk.VERTICAL )
scroll_dest.config (command = ch_dest.yview )
ch_dest ['yscrollcommand'] = scroll_dest.set
scroll_dest.grid (row=2, column=3, sticky=tk.S+tk.N )
ch_suj = tk.Text (self.frame,
width='80', height='2',
font=('Arial',10,'normal'))
ch_suj.configure (bg='ivory')
ch_suj.grid (row=3, column=2, columnspan=4, sticky=tk.N+tk.W)
if __name__ == '__main__':
root = tk.Tk()
root.title ('Creation de Lettres')
# suppress unwanted window
root.withdraw()
# main GUI, the parameter 0 means resizing turned off
mainUI = uiClass(root,
'850x700',
'+300+5',
0)
if not usingIDLE:
root.mainloop() |
Partager