Skip to content

Instantly share code, notes, and snippets.

@Fairies-Feast
Created June 28, 2021 18:33
Show Gist options
  • Save Fairies-Feast/3469618e176592a5b8cc4f94ac93c27e to your computer and use it in GitHub Desktop.
Save Fairies-Feast/3469618e176592a5b8cc4f94ac93c27e to your computer and use it in GitHub Desktop.
"""Cucumber helps people use tkinter fast, useful, and can clear frame/text.
It also helps with quick button making.
"""
from smtplib import SMTPException
from tkinter import *
import pickle
import winsound
from random import randrange
import calendar
import os
import time
import webbrowser
class Co:
PURPLE = '\033[95m'
CYAN = '\033[96m'
DARK_CYAN = '\033[36m'
BLUE = '\033[94m'
GREEN = '\033[92m'
YELLOW = '\033[93m'
RED = '\033[91m'
BOLD = '\033[1m'
UNDERLINE = '\033[4m'
END = '\033[0m'
root = Tk()
root.title("Cucumber Canvas")
f = Frame(root, width=400, height=400)
f.pack()
text = Text(f, height=10)
def allow_text():
text.pack()
def clear_text():
text.delete("1.0", "end")
def clear_frame():
f.destroy()
def button_create(word, color, do, x_value, y_value):
button0 = Button(f, text=str(word), fg=str(color), command=lambda: do)
button0.place(x=x_value, y=y_value)
def save_canvas_to_pickle(cool):
pickle.dump(cool, open("../save.p", "wb"))
def save_canvas_to_list(cool2):
canvas = [cool2]
return canvas
def send():
try:
share = pickle.load(open("cave.p", "rb"))
except None:
share = {'Brutus': '!2eS%67*', 'chocolate': '3756!A743b'}
un = input("Please enter your username:")
if un in share:
pw = input("Welcome " + un + ". Please enter your password:")
if share[un] == pw:
print("Welcome!")
else:
print("We did not find in our dictionaries the username " + un + ".")
new = input("Create a account! If you don't want to create one, click stop.")
share += new
pickle.dump(share, open("cave.p", "wb"))
class Sound:
@staticmethod
def random_sound():
free = randrange(47, 391)
duh = randrange(60, 180)
winsound.Beep(frequency=free, duration=duh)
@staticmethod
def stop():
quit(winsound)
class PillowBackup:
@staticmethod
def from_pillow(x, y, back_round):
red = Canvas(x, y, color=back_round)
red.pack()
@staticmethod
def upload_from_python(background, x, y):
red = Canvas(x, y, color=background)
red.create_text(x=70, y=89, text=background, font=('Times', 35))
red.pack()
def report(se):
pickle.dump(se, open("../rave.p", "wb"))
print(Co.GREEN + "Thanks for reporting a problem! It will be fixed soon!" + Co.END)
def link(txt, url):
def openurl():
print(url)
button0 = Button(text=txt, command=openurl)
button0.pack()
def date(year, month):
print(calendar.month(year, month))
def swallow():
o = os.getcwd()
r = randrange(404, 909)
print(o + "=copy=ip=" + o + "+exitcode=" + str(r))
def heat(temp_low, temp_high):
print("loading...")
time.sleep(1)
windows = Tk()
windows.title("Heating")
c2 = Canvas(windows, width=400, height=400)
c2.pack()
mylo = randrange(temp_low, temp_high)
stuff = Message(mylo + 30 * 10)
stuff.pack()
stuff.destroy()
def news():
try:
pickle.load(open("search.py", "rb"))
except None:
hi = input("No news!\nYou can add some news!:")
pickle.dump(hi, open("wave.p", "wb"))
def word_search():
print("Right below is a word search!")
print("")
print("S T Y E S O Y V J")
print("T O Z A L H E E U")
print("O O I T I O S T S")
print("P I T S D T T Y T")
class MoveInClass:
def __init__(self):
try:
self.thing = pickle.load(open("dave.p", "rb"))
except None:
self.thing = ["blah"]
self.cool = ""
def get(self, num):
p = self.thing[num]
return p
def main(self, par):
self.cool = par
if self.cool == "reset":
self.thing = ["BLAH"]
pickle.dump(self.thing, open("dave.p", "wb"))
else:
self.thing.append(self.cool)
pickle.dump(self.thing, open("dave.p", "wb"))
print(os.getcwd())
def __cucumber__(lnk):
webbrowser.open_new(lnk)
def super_sound(times: int, note: int):
count = 0
while count < times:
winsound.Beep(frequency=note, duration=238)
count += 1
def tv(url):
webbrowser.open(url)
def email(to, message, sender, password, title):
print("If there is an error, go to accounts.google.com/, click the security option on the left,"
"then scroll down to 'Allow less secure apps'. Make sure the slider is moved to the "
"on position. ")
import yagmail
yagmail.register(sender, password)
yag = yagmail.SMTP(sender)
yag.send(
to=to,
subject=title,
contents=message
)
def bot(dictionary, keep_running):
sent = input("Type command here:")
if sent in dictionary:
print(dictionary[sent])
if keep_running == "True":
bot(dictionary, "True")
else:
quit()
def __version__():
print("1.0.0")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment