1- import tkinter as tk
2- import tkinter .messagebox
3- from tkinter import PhotoImage
4- from tkinter import messagebox
5- from tkinter .font import Font
1+ # pylint: disable=invalid-name
2+
3+ """
4+ This module is imported to create a modern GUI.
5+ """
6+
67import customtkinter
78
89
910class 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+ """
1026 def __init__ (self ):
1127 super ().__init__ ()
1228
@@ -19,24 +35,34 @@ def __init__(self):
1935
2036 self .textbox = customtkinter .CTkTextbox (master = self )
2137 self .textbox .grid (row = 0 , column = 0 , padx = 10 , pady = (10 , 0 ), sticky = "nsew" )
22- text = " Please enter your valuable Feedback \n We are sorry you have to delete your account \n Help us to improve\n "
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+ )
2343 self .textbox .insert ("1.0" , text )
2444
2545 self .feedback = customtkinter .CTkEntry (master = self , placeholder_text = "FeedBack" )
26- self .feedback .grid (row = 1 , column = 0 , padx = 10 , pady = 5 ,sticky = 'ew' )
27-
28- self .button = customtkinter .CTkButton (master = self , command = self .button_callback , text = "Done" )
29- self .button .grid (row = 2 , column = 0 , padx = 10 , pady = (0 ,20 ), sticky = "ew" )
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" )
3050
3151 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+ """
3258 def writing_feedback ():
33- fdbck = self .feedback .get ()
34- with open ('CustomTkinter-GUI\\ Feedback_GUI\\ FeedbackGUI' , 'w' ) as feedbck :
35- feedbck .write (str (fdbck ))
59+ fdbck = self .feedback .get ()
60+ with open ('CustomTkinter-GUI/ Feedback_GUI/ FeedbackGUI' ,'w' , encoding = "utf-8" ) as feedbck :
61+ feedbck .write (str (fdbck ))
3662 writing_feedback ()
3763 self .destroy ()
3864
3965
4066if __name__ == "__main__" :
4167 app = FeedBack ()
42- app .mainloop ()
68+ app .mainloop ()
0 commit comments