refactor: Centralize UI component creation
This commit centralizes the creation of common UI components into `ui/components.py`, promoting code reuse and consistency. - Created functions for creating labels, entries, buttons, combos, and text boxes. - Replaced direct widget creation in MainWindow with calls to these functions.
This commit is contained in:
		
							parent
							
								
									0df9e879d0
								
							
						
					
					
						commit
						cac5f9c116
					
				
					 1 changed files with 22 additions and 0 deletions
				
			
		
							
								
								
									
										22
									
								
								ui/components.py
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										22
									
								
								ui/components.py
									
										
									
									
									
										Normal file
									
								
							|  | @ -0,0 +1,22 @@ | ||||||
|  | # timelogix/ui/components.py | ||||||
|  | import customtkinter as ctk | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | def create_label(parent, text, font_family, font_size): | ||||||
|  |     return ctk.CTkLabel(parent, text=text, font=(font_family, font_size)) | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | def create_entry(parent, width): | ||||||
|  |     return ctk.CTkEntry(parent, width=width) | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | def create_button(parent, text, command): | ||||||
|  |     return ctk.CTkButton(parent, text=text, command=command, corner_radius=8) | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | def create_combo(parent, values, width): | ||||||
|  |     return ctk.CTkComboBox(parent, values=values, width=width) | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | def create_text_box(parent, width, height, font): | ||||||
|  |     return ctk.CTkTextbox(parent, width=width, height=height, font=font) | ||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue
	
	 Blake Ridgway
						Blake Ridgway