Skip to content

Commit e68f3c2

Browse files
committed
GUI done
1 parent 28a792b commit e68f3c2

File tree

2 files changed

+460
-0
lines changed

2 files changed

+460
-0
lines changed

Emoji Dictionary/QT_GUI.py

Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
2+
# -*- coding: utf-8 -*-
3+
4+
import sys
5+
from PyQt5.QtCore import *
6+
from PyQt5.QtGui import *
7+
from PyQt5.QtWidgets import *
8+
from PyQt5 import uic
9+
10+
class MainWindow(QMainWindow):
11+
def __init__(self):
12+
super(MainWindow, self).__init__()
13+
14+
# Load the UI file
15+
uic.loadUi('Emoji Dictionary/QT_GUI.ui', self)
16+
cells = [
17+
["😀", "🥰", "😴", "🤓", "🤮", "🤬", "😨", "🤑", "😫", "😎"],
18+
["🐒", "🐕", "🐎", "🐪", "🐁", "🐘", "🦘", "🦈", "🐓", "🐝", "👀", "🦴", "👩🏿", "‍🤝", "🧑", "🏾", "👱🏽", "‍♀", "🎞", "🎨", "⚽"],
19+
["🍕", "🍗", "🍜", "☕", "🍴", "🍉", "🍓", "🌴", "🌵", "🛺", "🚲", "🛴", "🚉", "🚀", "✈", "🛰", "🚦", "🏳", "‍🌈", "🌎", "🧭"],
20+
["🔥", "❄", "🌟", "🌞", "🌛", "🌝", "🌧", "🧺", "🧷", "🪒", "⛲", "🗼", "🕌", "👁", "‍🗨", "💬", "™", "💯", "🔕", "💥", "❤"]
21+
]
22+
23+
self.emoji_buttons = []
24+
self.emoji_layout = QGridLayout()
25+
self.emoji_widget = QWidget()
26+
self.emoji_widget.setLayout(self.emoji_layout)
27+
self.frame_2.setLayout(QVBoxLayout())
28+
self.frame_2.layout().addWidget(self.emoji_widget)
29+
self.emoji_widget.hide()
30+
self.pushButton.clicked.connect(lambda: self.emoji_widget.show())
31+
32+
for row_idx, row in enumerate(cells):
33+
for col_idx, emoji in enumerate(row):
34+
button = QPushButton(emoji)
35+
button.setFixedSize(40, 40)
36+
button.setStyleSheet("""
37+
QPushButton {
38+
background-color: #ffffff;
39+
border: 1px solid #e0e0e0;
40+
border-radius: 5px;
41+
}
42+
QPushButton:hover {
43+
background-color: #f0f0f0;
44+
}
45+
""")
46+
# button.clicked.connect(lambda checked, e=emoji: self.emoji_clicked(e))
47+
self.emoji_layout.addWidget(button, row_idx, col_idx)
48+
self.emoji_buttons.append(button)
49+
if __name__ == '__main__':
50+
app = QApplication(sys.argv)
51+
window = MainWindow()
52+
window.show()
53+
sys.exit(app.exec_())

0 commit comments

Comments
 (0)