Amazing-Python-Scripts

Форк
0
1
from tkinter import *
2
from tkinter import messagebox
3
import Model
4

5

6
def search():
7
    word = enterWordEntry.get()
8

9
    text = word.strip()
10
    messagebox.showinfo("Input", " Input = "+text)
11
    model_object = Model.model()
12

13
    if word != "" and word != " " and word is not None:
14
        sentiment = model_object.get_sentimental_analysis(text)
15
        messagebox.showinfo("Result", sentiment)
16

17
    else:
18
        messagebox.showerror('Error', 'Invalid Input.Please double check it.')
19
        enterWordEntry.delete(0, END)
20

21

22
root = Tk()
23

24
root.geometry("1280x720+1000+30")
25

26
root.title("Text Sentimental Analysis")
27

28
root.resizable(False, False)
29

30
image = PhotoImage(
31
    file="./Text_Sentimental_Analysis_Script_with_GUI/images/background.png")
32
image_label = Label(root, image=image)
33
image_label.place(x=0, y=0)
34

35
enterWordLabel = Label(root, text='Enter Text for Analysis',
36
                       font=('castellar', 15, 'bold'), fg='black')
37
enterWordLabel.place(x=180, y=20)
38

39
enterWordEntry = Entry(root, font=('arial', 20, 'bold'), bd=5, justify=CENTER)
40
enterWordEntry.place(x=100, y=70)
41

42
enterWordEntry.focus_set()
43

44
searchImage = PhotoImage(
45
    file='./Text_Sentimental_Analysis_Script_with_GUI/images/search.png')
46
searchButton = Button(root, image=searchImage, bd=0, bg='whitesmoke', activebackground='whitesmoke', cursor='hand2',
47
                      command=search)
48
searchButton.place(x=450, y=50)
49

50
root.mainloop()
51

Использование cookies

Мы используем файлы cookie в соответствии с Политикой конфиденциальности и Политикой использования cookies.

Нажимая кнопку «Принимаю», Вы даете АО «СберТех» согласие на обработку Ваших персональных данных в целях совершенствования нашего веб-сайта и Сервиса GitVerse, а также повышения удобства их использования.

Запретить использование cookies Вы можете самостоятельно в настройках Вашего браузера.