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
|
#--- user variable ---
usingIDLE = 0 #set = 1 if running from IDLE, otherwise 0
#--- modules ---
import tkMessageBox, tkSimpleDialog, tkFileDialog, string
import os.path, glob, sys
import Tkinter as tk
# import ScrolledText
# from Tkconstants import LEFT, RIGHT, TOP, BOTTOM, END, Y
#--- classes ---
class uiClass:
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 = self.lance_exp)
btn_exp.place (x=30, y=20)
btn_date = tk.Button (self.frame,
text='date',
width=10, bd=4,
command = self.lance_date)
btn_date.place (x=500,y=20)
# champs
ch_exp = tk.Text (self.frame,
width='35', height='5',
font=('Arial',10,'normal'))
ch_exp.configure (bg='ivory')
ch_exp.place (x=190, y=20)
# scroll_exp = tk.Scrollbar (self.frame, orient = tk.VERTICAL)
# scroll_exp.config (command = self.frame.ch_exp.yview)
# ch_exp (yscrollcommand = self.frame.scroll_exp.set)
# COMMENT PLACER LE SCROLLBAR MAINTENANT ?
# LE MELANGE des METHODES PLACE ET GRID N APPORTE RIEN ?!
ch_date = tk.Text (self.frame,
width='30', height='1',
font=('Arial',10,'normal'))
ch_date.configure (bg='ivory')
ch_date.place (x=600, y=20)
def lance_date(self):
print 1
def lance_exp(self):
print 1
if __name__ == '__main__':
root = tk.Tk()
root.title ('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