Skip to content

Commit 4632720

Browse files
authored
Merge pull request qxresearch#33 from LoopGlitch26/add-bravish-contrib
Add more Applications
2 parents a6a9b66 + 642718c commit 4632720

4 files changed

Lines changed: 150 additions & 0 deletions

File tree

Applications/Calendar/calendar.py

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
from tkinter import *
2+
import calendar
3+
4+
win = Tk()
5+
win.title("GUI Calendar")
6+
7+
def text():
8+
year_str = year.get()
9+
month_str = month.get()
10+
year_int = int(year_str)
11+
month_int = int (month_str)
12+
cal = calendar.month(year_int, month_int)
13+
textfield.delete(0.0, END)
14+
textfield.insert(INSERT, cal)
15+
16+
label1 = Label(win, text = '{Year} ')
17+
label1.grid(row = 0, column = 0)
18+
label1 = Label(win, text = '{Month} ')
19+
label1.grid(row = 0, column = 1)
20+
21+
year = Spinbox(win, from_= 1947, to = 2150, width = 24)
22+
year.grid(row = 1, column = 0, padx = 16)
23+
month = Spinbox(win, from_= 1, to = 12, width = 3)
24+
month.grid(row = 1, column = 1)
25+
26+
button = Button(win, text = "{GO}", command = text)
27+
button.grid(row = 1, column = 2)
28+
29+
textfield = Text(win, height = 10, width = 30, foreground = 'brown')
30+
textfield.grid(row = 3, columnspan = 3)
31+
32+
win.mainloop()

Applications/Paint/paint.py

Lines changed: 73 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,73 @@
1+
from tkinter import *
2+
from tkinter.colorchooser import askcolor
3+
4+
class Paint(object):
5+
pen_size = 5.0
6+
color = 'black'
7+
8+
def __init__(self):
9+
self.root = Tk()
10+
11+
self.pen_button = Button(self.root, text = 'pen', command = self.use_pen)
12+
self.pen_button.grid(row = 0, column = 0)
13+
14+
self.brush_button = Button(self.root, text = 'brush', command = self.use_brush)
15+
self.brush_button.grid(row=0, column=1)
16+
17+
self.color_button = Button(self.root, text='color', command=self.choose_color)
18+
self.color_button.grid(row=0, column=2)
19+
20+
self.eraser_button = Button(self.root, text='eraser', command=self.use_eraser)
21+
self.eraser_button.grid(row=0, column=3)
22+
23+
self.choose_size_button = Scale(self.root, from_=1, to=10, orient=HORIZONTAL)
24+
self.choose_size_button.grid(row=0, column=4)
25+
26+
self.c=Canvas(self.root, bg='white', width=600, height=600)
27+
self.c.grid(row=1, columnspan=5)
28+
29+
self.setup()
30+
self.root.mainloop()
31+
32+
def setup(self):
33+
self.old_x = None
34+
self.old_y = None
35+
self.line_width = self.choose_size_button.get()
36+
self.color = self.color
37+
self.eraser_on = False
38+
self.active_button = self.pen_button
39+
self.c.bind('<B1-Motion>', self.print)
40+
self.c.bind('<ButtonRelease-1>', self.reset)
41+
42+
def use_pen(self):
43+
self.activate_button(self.pen_button)
44+
45+
def use_brush(self):
46+
self.activate_button(self.brush_button)
47+
48+
def choose_color(self):
49+
self.eraser_on = False
50+
self.color = askcolor(color=self.color)[1]
51+
52+
def use_eraser(self):
53+
self.activate_button(self.eraser_button, eraser_mode=True)
54+
55+
def activate_button(self, some_button, eraser_mode=False):
56+
self.activate_button.config(relief=RAISED)
57+
some_button.config(relief=SUNKEN)
58+
self.active_button = some_button
59+
self.eraser_on = eraser_mode
60+
61+
def print(self, event):
62+
self.line_width = self.choose_size_button.get()
63+
paint_color = 'white' if self.eraser_on else self.color
64+
if self.old_x and self.old_y:
65+
self.c.create_line(self.old_x, self.old_y, event.x, event.y, width=self.line_width, fill=paint_color, capstyle=ROUND, smooth=TRUE, splinesteps=36)
66+
self.old_x = event.x
67+
self.old_y = event.y
68+
69+
def reset(self, event):
70+
self.old_x, self.old_y = None, None
71+
72+
if __name__ =='__main__':
73+
Paint()
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
from tkinter import*
2+
3+
win = Tk()
4+
win.title("LoopGlitch Screenshoter")
5+
6+
def callback():
7+
mySS = pyautogui.screenshot()
8+
mySS.save(r'E:\PyCharm\mySSpy.jpg') #r'Path to save the screenshot\file name.png or jpg'
9+
10+
button = Button(win, text = "Screenshot This !", command = callback)
11+
button.grid(row = 50, column = 50)
12+
13+
win.mainloop()
Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
from tkinter import *
2+
import wikipedia
3+
4+
5+
def get_data():
6+
entry_value = entry.get()
7+
answer.delete(1.0, END)
8+
try:
9+
answer_value = wikipedia.summary(entry_value)
10+
answer.insert(INSERT, answer_value)
11+
except:
12+
answer.insert(INSERT, "ERROR! Invalid input or poor internet connection")
13+
14+
win = Tk()
15+
win.title("Wikipedia Search")
16+
topframe = Frame(win)
17+
entry = Entry(topframe)
18+
entry.pack()
19+
button = Button(topframe, text="search", command=get_data)
20+
button.pack()
21+
topframe.pack(side = TOP)
22+
23+
24+
bottomframe = Frame(win)
25+
scroll = Scrollbar(bottomframe)
26+
scroll.pack(side=RIGHT, fill=Y)
27+
answer = Text(bottomframe, width=50, height=20, yscrollcommand = scroll.set, wrap=WORD)
28+
scroll.config(command=answer.yview)
29+
answer.pack()
30+
bottomframe.pack()
31+
32+
win.mainloop()

0 commit comments

Comments
 (0)