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
+
6
7
import customtkinter
7
8
8
9
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
+ """
10
26
def __init__ (self ):
11
27
super ().__init__ ()
12
28
@@ -19,24 +35,34 @@ def __init__(self):
19
35
20
36
self .textbox = customtkinter .CTkTextbox (master = self )
21
37
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
+ )
23
43
self .textbox .insert ("1.0" , text )
24
44
25
45
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" )
30
50
31
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
+ """
32
58
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 ))
36
62
writing_feedback ()
37
63
self .destroy ()
38
64
39
65
40
66
if __name__ == "__main__" :
41
67
app = FeedBack ()
42
- app .mainloop ()
68
+ app .mainloop ()
0 commit comments