-
Notifications
You must be signed in to change notification settings - Fork 0
/
real754.py
116 lines (89 loc) · 3.74 KB
/
real754.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
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
108
109
110
111
112
113
114
115
116
from tkinter import *
import tkinter as tk
from methods import *
from menu import *
import subprocess
import threading
class ApplicationR:
def __init__(self, master=None):
self.standardFont = ("Arial", "10")
self.standardShow = ("Arial", "9", "bold")
self.firstContainer = Frame(master)
self.firstContainer["pady"] = 10
self.firstContainer.pack()
self.secondContainer = Frame(master)
self.secondContainer["padx"] = 5
self.secondContainer.pack()
self.extraContainer = Frame(master)
self.extraContainer["padx"] = 5
self.extraContainer.pack()
self.thirdContainer = Frame(master)
self.thirdContainer["padx"] = 5
self.thirdContainer.pack()
self.fourthContainer = Frame(master)
self.fourthContainer["pady"] = 10
self.fourthContainer.pack()
#######################
self.fiveContainer = Frame(master)
self.fiveContainer["pady"]= 10
self.fiveContainer.pack()
#######################
self.title = Label(self.firstContainer, text="IEEE754")
self.title["font"] = ("Arial", "10", "bold")
self.title.pack()
self.integerReal = Label(self.secondContainer, text="Real:", font=self.standardFont)
self.integerReal.pack()
self.real = Entry(self.secondContainer)
self.real["width"] = 15
self.real["font"] = self.standardFont
self.real.pack(side=LEFT)
self.precision = Entry(self.extraContainer)
self.precision["width"] = 15
self.precision["font"] = self.standardFont
self.precision.pack(side=LEFT)
self.binaryLabel = Label(self.thirdContainer, text="Binary:", font=self.standardFont)
self.binaryLabel.pack()
self.binary = Entry(self.thirdContainer)
self.binary["width"] = 15
self.binary["font"] = self.standardFont
self.binary.pack(side=LEFT)
self.authenticate = Button(self.fourthContainer, text="Start")
self.authenticate["font"] = self.standardFont
self.authenticate["width"] = 10
self.authenticate["command"] = self.authenticateStart
self.authenticate.pack()
self.back = Button(self.fourthContainer, text="Back")
self.back["font"] = self.standardFont
self.back["width"] = 10
self.back["command"] = self.backInterface
self.back.pack()
self.msgReal = Label(self.fourthContainer, text="", font=self.standardShow)
self.msgReal.pack()
self.msgBinary = Label(self.fourthContainer, text="", font=self.standardShow)
self.msgBinary.pack()
def authenticateStart(self):
real = self.real.get()
binary = self.binary.get()
precision = self.precision.get()
if(binary != ""):
convertBinary = realConvert()
valueReal = convertBinary.runBR(binary)
self.msgReal["text"] = str(valueReal)
else:
self.msgReal["text"] = "No pass value"
if(real != ""):
convertReal = realConvert()
valueB = convertReal.runRB(float(real), int(precision))
self.msgBinary["text"] = str(valueB)
else:
self.msgBinary["text"] = "No pass value"
def backInterface(self):
thread_one = threading.Thread(target=root.destroy())
thread_two = threading.Thread(target=runS())
thread_one.start();
thread_two.start();
def runR(self):
global root
root = Tk()
ApplicationR(root)
root.mainloop()