forked from MircoT/py-pdp8-tk
-
Notifications
You must be signed in to change notification settings - Fork 0
/
__main__.py
62 lines (43 loc) · 1.63 KB
/
__main__.py
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
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# per eseguire il programma:
# > python pypdp8tk/
from sys import exit
from Tkinter import Tk, Toplevel, Canvas, N, S, E, W, NW, HORIZONTAL
from pdp8 import pdp8
from AutoScrollbar import AutoScrollbar
from Emulatore import Emulatore
from Editor import Editor
def run():
"""
Esegue l'emulatore del pdp8
"""
CD = pdp8()
principale = Tk()
principale.title("Pdp8 Emulator : Assembly Editor")
emulatore = Toplevel()
emulatore.title("Pdp8 Emulator")
emulatore.geometry("1015x589")
edit = Editor(principale, CD)
scrollbar1 = AutoScrollbar(emulatore)
scrollbar1.grid(row=0, column=1, sticky=N + S)
scrollbar2 = AutoScrollbar(emulatore, orient=HORIZONTAL)
scrollbar2.grid(row=1, column=0, sticky=E + W)
finestra = Canvas(emulatore,
yscrollcommand=scrollbar1.set,
xscrollcommand=scrollbar2.set)
finestra.grid(row=0, column=0, sticky=N + S + E + W)
scrollbar1.config(command=finestra.yview)
scrollbar2.config(command=finestra.xview)
emulatore.grid_rowconfigure(0, weight=1)
emulatore.grid_columnconfigure(0, weight=1)
emul = Emulatore(finestra, edit, CD, emulatore)
finestra.create_window(0, 0, anchor=NW, window=emul.master)
emul.master.update_idletasks()
finestra.config(scrollregion=finestra.bbox("all"))
principale.protocol("WM_DELETE_WINDOW", edit.exit)
emulatore.protocol("WM_DELETE_WINDOW", emul.exit)
principale.mainloop()
emulatore.mainloop()
if __name__ == '__main__':
exit(run())