Skip to content

Emoji dictionary g UI update #2716

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
82 changes: 82 additions & 0 deletions Emoji Dictionary/QT_GUI.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,82 @@

# -*- coding: utf-8 -*-

import sys
from PyQt5.QtCore import *
from PyQt5.QtGui import *
from PyQt5.QtWidgets import *
from PyQt5 import uic
from emoji import demojize
import os

class MainWindow(QMainWindow):
def __init__(self):
super(MainWindow, self).__init__()

# Load the UI file
uic.loadUi(os.path.join(os.path.dirname(__file__),'QT_GUI.ui'),self)
self.pushButton_4.clicked.connect(self.close)
self.pushButton_2.clicked.connect(lambda:search_emoji())
self.pushButton_3.clicked.connect(lambda:clear_text())
cells = [

["🐒", "🐕", "🐎", "🐪", "🐁", "🐘", "🦘", "🦈", "🐓", "🐝", "👀", "🦴", "👩🏿", "‍🤝", "🧑", "🏾", "👱🏽", "‍♀", "🎞", "🎨", "⚽"],
["🍕", "🍗", "🍜", "☕", "🍴", "🍉", "🍓", "🌴", "🌵", "🛺", "🚲", "🛴", "🚉", "🚀", "✈", "🛰", "🚦", "🏳", "‍🌈", "🌎", "🧭"],
["🔥", "❄", "🌟", "🌞", "🌛", "🌝", "🌧", "🧺", "🧷", "🪒", "⛲", "🗼", "🕌", "👁", "‍🗨", "💬", "™", "💯", "🔕", "💥", "❤"],
["😀", "🥰", "😴", "🤓", "🤮", "🤬", "😨", "🤑", "😫", "😎"],
]
def emoji_wight_btn():
if self.emoji_widget.isVisible():
self.emoji_widget.hide()
else:
self.emoji_widget.show()

def search_emoji():
word = self.lineEdit.text()
print(f"Field Text: {word}")
if word == "":
self.textEdit.setText("You have entered no emoji.")
else:
means = demojize(word)
self.textEdit.setText("Meaning of Emoji : " + str(word) + "\n\n" + means.replace("::", ":\n: "))

def add_input_emoji(emoji):
self.lineEdit.setText(self.lineEdit.text() + emoji)

def clear_text():
self.lineEdit.setText("")
self.textEdit.setText("")

self.emoji_buttons = []
self.emoji_layout = QGridLayout()
self.emoji_widget = QWidget()
self.emoji_widget.setLayout(self.emoji_layout)
self.frame_2.layout().addWidget(self.emoji_widget)
self.emoji_widget.hide()
self.pushButton.clicked.connect(lambda:emoji_wight_btn())


for row_idx, row in enumerate(cells):
for col_idx, emoji in enumerate(row):
button = QPushButton(emoji)
button.setFixedSize(40, 40)
button.setFont(QFont("Arial", 20))
button.setStyleSheet("""
QPushButton {
background-color: #ffffff;
border: 1px solid #e0e0e0;
border-radius: 5px;
}
QPushButton:hover {
background-color: #f0f0f0;
}
""")
button.clicked.connect(lambda checked, e=emoji: add_input_emoji(e))
self.emoji_layout.addWidget(button, row_idx, col_idx)
self.emoji_buttons.append(button)

if __name__ == '__main__':
app = QApplication(sys.argv)
window = MainWindow()
window.show()
sys.exit(app.exec_())
Loading
Loading