Skip to content

Commit 19ec3d1

Browse files
Merge pull request #1869 from HartzFrequency/master
[GSSoC 23'] Feedback GUI mechanism
2 parents f3ca268 + a7c5524 commit 19ec3d1

File tree

3 files changed

+72
-0
lines changed

3 files changed

+72
-0
lines changed
Lines changed: 68 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,68 @@
1+
# pylint: disable=invalid-name
2+
3+
"""
4+
This module is imported to create a modern GUI.
5+
"""
6+
7+
import customtkinter
8+
9+
10+
class FeedBack(customtkinter.CTk):
11+
"""
12+
A class representing a feedback GUI.
13+
14+
This class inherits from customtkinter.CTk and provides a graphical user interface
15+
for collecting user feedback.
16+
17+
Attributes:
18+
textbox (customtkinter.CTkTextbox): The text box widget for displaying instructions.
19+
feedback (customtkinter.CTkEntry): The entry widget for collecting user feedback.
20+
button (customtkinter.CTkButton): The button widget for submitting the feedback.
21+
22+
Methods:
23+
__init__(): Initializes the FeedBack class.
24+
button_callback(): Callback function for the button click event.
25+
"""
26+
def __init__(self):
27+
super().__init__()
28+
29+
self.geometry("300x200")
30+
self.title("User FeedBack")
31+
self.minsize(300, 200)
32+
33+
self.grid_rowconfigure(0, weight=1)
34+
self.grid_columnconfigure(0, weight=1)
35+
36+
self.textbox = customtkinter.CTkTextbox(master=self)
37+
self.textbox.grid(row=0, column=0, padx=10, pady=(10, 0), sticky="nsew")
38+
text = (
39+
" Please enter your valuable Feedback \n"
40+
" We are sorry you have to delete your account \n"
41+
" Help us to improve\n"
42+
)
43+
self.textbox.insert("1.0", text)
44+
45+
self.feedback = customtkinter.CTkEntry(master=self, placeholder_text="FeedBack")
46+
self.feedback.grid(row=1, column=0, padx=10, pady=5, sticky='ew')
47+
48+
self.button = customtkinter.CTkButton(master=self, command=self.button_callback,text="Done")
49+
self.button.grid(row=2, column=0, padx=10, pady=(0, 20), sticky="ew")
50+
51+
def button_callback(self):
52+
"""
53+
Callback function for the button click event.
54+
55+
This function is triggered when the user clicks the "Done" button.
56+
It retrieves the user feedback from the input field and writes it to a file.
57+
"""
58+
def writing_feedback():
59+
fdbck = self.feedback.get()
60+
with open('CustomTkinter-GUI/Feedback_GUI/FeedbackGUI','w',encoding="utf-8") as feedbck:
61+
feedbck.write(str(fdbck))
62+
writing_feedback()
63+
self.destroy()
64+
65+
66+
if __name__ == "__main__":
67+
app = FeedBack()
68+
app.mainloop()
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
nice
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
## SIGN UP GUI PAGE
2+
3+
To run the code, you need to specify the file paths where the feedback will be stored in a .txt format. Once you have set the file paths correctly, you can simply run the program.

0 commit comments

Comments
 (0)