-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathsource.py
101 lines (76 loc) · 3.46 KB
/
source.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
# Developed by Cyrus Software LLC. | Published by Dawnstar Entertainment LLC.
########################################################################################################################
import tkinter as tk
from tkinter import ttk
class Application(tk.Frame):
def __init__(self, master=None):
super().__init__(master)
self.master = master
master.title("Siren Tool Converter")
master.maxsize(900,600)
master.config(bg = "black")
frame = tk.Frame(master,width=800,height=300,bg="white")
frame.grid(row = 0,column = 0,padx=10,pady=5)
label = ttk.Label(frame, text='Enter Binary Number:').grid(row = 0,column =0,padx = 5,pady=5 )
button = ttk.Button(frame, text='Convert',command=self.generate).grid(row = 0,column = 4,padx = 5,pady = 5)
self.username = tk.StringVar()
self.results = tk.StringVar()
answer = ttk.Label(frame,textvariable=self.results).grid(row=1,column=1,padx = 5 ,pady = 5)
name = ttk.Entry(frame, textvariable=self.username).grid(row = 0, column = 1,padx = 5,pady=5)
print('Siren Tool Converter | Dawnstar Ent.\n')
print('Developted By @iitztoasty on discord\n\n\n')
print('INSTRUCTIONS\n')
print('1. Export your pattern')
print('2. Find SirenExport.txt')
print('3. Copy & Paste only one binary value at a time\n')
print('P.S. Only convert UNIQUE BINARIES at bottom of the file')
def generate(self,*args):
value = str(self.username.get())
try:
value = str(self.username.get())
self.results.set("Answer = {}".format(int(value,2)))
except ValueError:
self.results.set("Invalid Input {}".format(value))
root = tk.Tk()
app = Application(master=root)
app.mainloop()
########################################################################################################################
import sys
from PyQt5 import QtWidgets as qtw
from PyQt5 import QtCore as qtc
from PyQt5 import QtGui as qtg
class binary(qtg.QValidator):
def validate(self,string,index):
print(string,index)
if all([i=="1" or i == "0" for i in str(string)]):
state = qtg.QValidator.Acceptable
elif string == "":
state = qtg.QValidator.Intermediate
else:
state = qtg.QValidator.Invalid
return (state,string,index)
class MainWindow(qtw.QWidget):
def __init__(self,*args,**kwargs):
super().__init__()
self.setLayout(qtw.QGridLayout())
label1 = qtw.QLabel("Enter a Binary Number")
self.convert = qtw.QPushButton("Convert")
self.answer = qtw.QLabel()
self.line = qtw.QLineEdit()
self.line.setValidator(binary())
self.answer.setAlignment(qtc.Qt.AlignHCenter)
self.layout().addWidget(label1,0,1)
self.layout().addWidget(self.line,0,2)
self.layout().addWidget(self.answer,1,0,1,4)
self.layout().addWidget(self.convert,0,4)
self.convert.clicked.connect(self.converter)
self.show()
def converter(self):
decimal = self.line.text()
binary = int(str(decimal),2)
self.answer.setText(str(binary))
if __name__ == "__main__":
app = qtw.QApplication(sys.argv)
win = MainWindow()
sys.exit(app.exec_())
########################################################################################################################