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