88from tkinter import messagebox , filedialog , Toplevel , colorchooser
99from tkinter import font , BooleanVar
1010
11-
1211class Ventana (Frame ):
1312 def __init__ (self , master ):
1413 super ().__init__ ( master )
1514 self .master .title ('Bloc de Notas' )
1615 self .master .iconbitmap ('icono.ico' )
1716 self .master .geometry ('700x500+380+20' )
1817 self .master .protocol ("WM_DELETE_WINDOW" , self .salir )
19-
2018 self .señal_ajustes = BooleanVar ()
2119 self .info_estado = BooleanVar ()
2220 self .info_estado .set (False )
@@ -26,8 +24,6 @@ def __init__(self, master):
2624 self .y = 0
2725 self .n = 12
2826 self .f = 'Arial'
29-
30-
3127 self .widgets ()
3228 self .master .columnconfigure (0 , weight = 1 )
3329 self .master .rowconfigure (0 , weight = 1 )
@@ -43,7 +39,6 @@ def widgets(self):
4339 archivo .add_command (label = "Guardar" , command = self .guardar_archivo )
4440 archivo .add_separator ()
4541 archivo .add_command (label = "Salir" , command = self .master .quit )
46-
4742 edicion = Menu (menu , tearoff = 0 )
4843 edicion .add_command (label = "Deshacer" , command = lambda : self .texto .edit_undo ())
4944 edicion .add_separator ()
@@ -75,7 +70,6 @@ def widgets(self):
7570 ayuda .add_command (label = "Ver la ayuda" )
7671 ayuda .add_separator ()
7772 ayuda .add_command (label = "Acerca del Bloc de notas" , command = self .acerca_de )
78-
7973 menu .add_cascade (label = "Archivo" , menu = archivo )
8074 menu .add_cascade (label = "Edicion" , menu = edicion )
8175 menu .add_cascade (label = "Formato" , menu = formato )
@@ -90,7 +84,6 @@ def widgets(self):
9084 ladoy .grid (column = 1 , row = 0 , sticky = 'ns' )
9185 self .texto .configure (xscrollcommand = ladox .set , yscrollcommand = ladoy .set )
9286 self .barra_estado = Label (self .master , font = ('Segoe UI Symbol' , 10 ))
93-
9487 def ajustes_de_linea (self ):
9588 if self .señal_ajustes .get () == True :
9689 self .texto .config (wrap = 'word' )
@@ -131,17 +124,14 @@ def salir(self):
131124 self .master .quit ()
132125
133126 def abrir_archivo (self ):
134- direcion = filedialog .askopenfilename (initialdir = '/' ,
135- title = 'Archivo' ,
136- filetype = (('txt files' , '*.txt*' ),('All files' , '*.*' )))
127+ direcion = filedialog .askopenfilename (initialdir = '/' , title = 'Archivo' ,
128+ filetype = (('txt files' , '*.txt*' ),('All files' , '*.*' )))
137129 if direcion != '' :
138130 archivo = open (direcion , 'r' )
139131 contenido = archivo .read ()
140132 self .texto .delete ('1.0' , 'end' )
141133 self .texto .insert ('1.0' , contenido )
142134 self .master .title (direcion )
143-
144-
145135 def guardar_archivo (self ):
146136 try :
147137 filename = filedialog .asksaveasfilename (defaultextension = '.txt' )
@@ -177,8 +167,7 @@ def acerca_de(self):
177167 text = 'Programa realizado en Python \n con la liberia de Tkinter \n \n Autor: Magno Efren' ).pack (expand = True )
178168 vent_info .mainloop ()
179169
180-
181- def formato_fuente (self ):
170+ def formato_fuente (self ):
182171 self .vent_tipo_fuente = Toplevel ()
183172 self .vent_tipo_fuente .overrideredirect (1 )
184173 self .vent_tipo_fuente .geometry ('390x290+400+200' )
@@ -258,4 +247,4 @@ def elegir_color_fondo(self):
258247 app = Ventana (ventana )
259248 app .mainloop ()
260249
261-
250+
0 commit comments