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
| # -*- coding: cp1252 -*-
from Tkinter import *
import subprocess
def comp():
for i in range(3):
subprocess.call(["latex", "test.tex"])
def start():
pop=Toplevel()
pop.resizable(width=False, height=False)
pop.grab_set()
pop.focus_set()
pop.title("PopUp")
w=250
h=220
pop.geometry("%dx%d+%d+%d" %(w,h,(pop.winfo_screenwidth()-w)/2,(pop.winfo_screenheight()-h)/2))
ca=Canvas(pop,bd=0,highlightthickness=0,bg='white')
ca.pack(fill=BOTH, expand=1)
cb=Canvas(ca,bd=0,highlightthickness=0,bg='white')
cb.grid(row=0, sticky=N+S+E+W)
ca.grid_rowconfigure(0, weight=1)
ca.grid_columnconfigure(0, weight=1)
lb=Label(cb,text='Je suis un popup',bg='white')
lb.grid()
comp()
pop.destroy()
root=Tk()
wt=root.winfo_screenwidth()
ht=root.winfo_screenheight()
w=300
h=300
root.geometry("%dx%d+%d+%d" % (w,h, (wt-w)/2, (ht-h)/2 ) )
# create a canvas with no internal border
can=Canvas(root,bd=0, highlightthickness=0)
can.pack(fill=BOTH, expand=1)
Button(can, text='Start',command=start).pack()
Button(can, text='Ciao',command=root.destroy).pack()
root.mainloop() |
Partager