-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathcommands.py
More file actions
81 lines (60 loc) · 1.95 KB
/
commands.py
File metadata and controls
81 lines (60 loc) · 1.95 KB
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
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
import ScrolledText
import speech_recognition as sr
from Tkinter import *
import tkFileDialog
import tkMessageBox
def ifStatement():
textPad.insert(INSERT, "if (): \t #if statement here\nelif (): \t "
"#if statement here \nelse: \t #else statement here")
def forLoop():
textPad.insert(INSERT, "for i in range():")
def equal():
textPad.insert(INSERT, "= ")
def doubleEqual():
textPad.insert(INSERT, "== ")
def lessThan():
textPad.insert(INSERT, "< ")
def greaterThan():
textPad.insert(INSERT, "> ")
def bigEqual():
textPad.insert(INSERT, ">= ")
def lowEqual():
textPad.insert(INSERT, "<= ")
def newLine():
textPad.insert(INSERT, "\n")
def randomNum():
textPad.insert(INSERT, "random.randint(1,10)")
def getSpace():
textPad.insert(INSERT, " ")
def getTab():
textPad.insert(INSERT, "\t")
def getPrint():
textPad.insert(INSERT, "print \"" )
def closeT():
textPad.insert(INSERT, "\"" )
def standard_write(string):
textPad.insert(INSERT, string)
getSpace()
def open_command():
file = tkFileDialog.askopenfile(parent=root,mode='rb',title='Select a file')
if file != None:
contents = file.read()
textPad.insert('1.0',contents)
file.close()
def save_command():
file = tkFileDialog.asksaveasfile(mode='w')
if file != None:
# slice off the last character from get, as an extra return is added
data = textPad.get('1.0', END+'-1c')
file.write(data)
file.close()
def about_command():
label = tkMessageBox.showinfo("About", "Code by Voice\nCihan SELİM")
def exit_command():
if tkMessageBox.askokcancel("Quit", "Do you really want to quit?"):
root.destroy()
root = Tk()
textPad = ScrolledText.ScrolledText(root, width=100, height=40, font=("Consolas", 12, "normal"))
textPad.config(background="#282828",foreground ="white",insertbackground="white")