Пример #1
0
    def draw_bill_frame_widgets(self):
        self.chargeList = [
            'Items Cost', 'Service Charge', 'GST Charges', 'Discount', 'Total'
        ]
        self.chargeValues = [tk.StringVar() for item in self.chargeList]

        for row, item in enumerate(self.chargeList):
            label = CustomLabel(self.bill_frame, text=item, width=12)
            label.grid(row=row, column=0, pady=(3, 0))

            entry = CustomEntry(self.bill_frame,
                                textvariable=self.chargeValues[row])
            entry.grid(row=row, column=1, pady=(3, 0))

        self.name_frame = tk.LabelFrame(self.bill_frame)
        self.name_frame.grid(row=5,
                             column=0,
                             columnspan=2,
                             pady=(15, 0),
                             padx=3)

        self.customer_name = tk.StringVar()
        self.name = CustomLabel(self.name_frame, text='Name', width=7)
        self.name_entry = CustomEntry(self.name_frame,
                                      width=15,
                                      textvariable=self.customer_name)
        self.name.grid(row=0, column=0, pady=2, padx=1)
        self.name_entry.grid(row=0, column=1, pady=2, padx=1)
Пример #2
0
    def draw_login_frame(self):
        self.head.destroy()
        self.body.destroy()

        self.head = tk.Frame(self, width=250, height=150)
        self.body = tk.Frame(self, width=250, height=100)

        self.head.grid(row=0, column=0)
        self.body.grid(row=1, column=0)

        self.head.grid_propagate(False)
        self.body.grid_propagate(False)

        self.header = tk.Label(self.head,
                               width=100,
                               height=140,
                               image=avtar,
                               text='\nLogin',
                               compound=tk.TOP,
                               fg='black',
                               font=('Arial', 12, 'bold'),
                               cursor='hand2')
        self.header.bind("<Button-1>", self.to_home_page)
        self.header.grid(row=0, column=0, pady=8, padx=70)

        if self.on_home:
            self.email_ = CustomEntry(self.body,
                                      text='Email',
                                      width=26,
                                      textvariable=self.email_id)
            self.email_.grid(row=0, column=0, padx=(25, 12), pady=20)

            self.send = tk.Button(self.body,
                                  image=send,
                                  relief=tk.FLAT,
                                  command=self.fetch_email)
            self.send.grid(row=0, column=1, padx=10, pady=20)

            self.not_registered = tk.Label(
                self.body,
                text='Not a registered user, SignUp here',
                font=('Arial', 8, 'underline'),
                fg='blue',
                cursor='hand2')
            self.not_registered.bind("<Button-1>", self.to_signup)
            self.not_registered.grid(row=1, column=0, columnspan=2)

        else:
            self.header['text'] = '\nHello ' + self.username.get()
            self.pass_ = CustomEntry(self.body,
                                     text='Password',
                                     width=26,
                                     textvariable=self.password)
            self.pass_.grid(row=0, column=0, padx=20, pady=20)

            self.send = tk.Button(self.body,
                                  image=send,
                                  relief=tk.FLAT,
                                  command=self.verify_login)
            self.send.grid(row=0, column=1, padx=10, pady=20)
	def draw_item_frame_widgets(self):
		for row, item in enumerate(self.itemList):			
			label = CustomLabel(self.items_frame, text=(' ' + item))
			label.grid(row=row, column=0, pady=(4,0))

			entry = CustomEntry(self.items_frame, textvariable=self.entryValues[row])
			entry.grid(row=row, column=1, pady=(4,0))
Пример #4
0
    def draw_calculator_frame_widgets(self):
        self.input_string = tk.StringVar()
        self.calc_entry = CustomEntry(self.calculator,
                                      width=23,
                                      textvariable=self.input_string)
        self.calc_entry.grid(row=0,
                             column=0,
                             columnspan=4,
                             pady=(5, 3),
                             padx=4)

        self.seven = self.create_button(self.calculator, '7', '#248aa2',
                                        "white", lambda: self.get('7'), 1, 0)
        self.eight = self.create_button(self.calculator, '8', '#248aa2',
                                        "white", lambda: self.get('8'), 1, 1)
        self.nine = self.create_button(self.calculator, '9', '#248aa2',
                                       "white", lambda: self.get('9'), 1, 2)
        self.plus = self.create_button(self.calculator, '+', 'white', "black",
                                       lambda: self.get('+'), 1, 3)
        self.four = self.create_button(self.calculator, '4', '#248aa2',
                                       "white", lambda: self.get('4'), 2, 0)
        self.five = self.create_button(self.calculator, '5', '#248aa2',
                                       "white", lambda: self.get('5'), 2, 1)
        self.six = self.create_button(self.calculator, '6', '#248aa2', "white",
                                      lambda: self.get('6'), 2, 2)
        self.minus = self.create_button(self.calculator, '-', 'white', "black",
                                        lambda: self.get('-'), 2, 3)
        self.one = self.create_button(self.calculator, '1', '#248aa2', "white",
                                      lambda: self.get('1'), 3, 0)
        self.two = self.create_button(self.calculator, '2', '#248aa2', "white",
                                      lambda: self.get('2'), 3, 1)
        self.three = self.create_button(self.calculator, '3', '#248aa2',
                                        "white", lambda: self.get('3'), 3, 2)
        self.mult = self.create_button(self.calculator, '*', 'white', "black",
                                       lambda: self.get('*'), 3, 3)
        self.clear = self.create_button(self.calculator, 'C', '#248aa2',
                                        "white", self.delete_calc_text, 4, 0)
        self.zero = self.create_button(self.calculator, '0', '#248aa2',
                                       "white", lambda: self.get('0'), 4, 1)
        self.equal = self.create_button(self.calculator, '=', '#248aa2',
                                        "white", self.evaluate_expression, 4,
                                        2)
        self.div = self.create_button(self.calculator, '/', 'white', "black",
                                      lambda: self.get('/'), 4, 3)
    def draw_header_widgets(self):
        self.header = tk.Label(self.title_frame,
                               text='InstaLoader',
                               font=('Copperplate Gothic Light', 25, 'bold'),
                               bg='white')
        self.header.grid(row=0, column=0, pady=(10, 5), padx=15)

        self.username = tk.StringVar()
        self.entry = CustomEntry(self.search_frame,
                                 width=33,
                                 textvariable=self.username)
        self.entry.grid(row=0, column=0, pady=(8, 5), padx=(15, 2))
        self.entry.bind('<Return>', self.search_user)

        self.search = tk.Button(self.search_frame,
                                image=search_icon,
                                bg='white',
                                cursor='hand2',
                                command=self.search_user,
                                relief=tk.FLAT)
        self.search.grid(row=0, column=1, pady=(8, 5), padx=2)

        self.settings = tk.Button(self.search_frame,
                                  image=settings_icon,
                                  bg='white',
                                  cursor='hand2',
                                  command=self.ask_credentials,
                                  relief=tk.FLAT,
                                  height=45,
                                  width=30)
        self.settings.grid(row=0, column=2, pady=0, padx=0)

        self.left_label = tk.Label(self.insta_frame,
                                   width=1,
                                   height=8,
                                   bg='dodgerblue3')
        self.insta_label = tk.Label(self.insta_frame,
                                    width=90,
                                    height=97,
                                    image=insta_icon,
                                    bg='white')

        self.left_label.grid(row=0, column=0)
        self.insta_label.grid(row=0, column=1)
	def draw_display_contact_frame(self):
		self.search_term.set('')

		# frames
		self.new_contact_frame = tk.Frame(self, width=300, height=400, bg='gray')
		self.create_contact_frame = tk.Frame(self.new_contact_frame, width=300, height=350)
		self.bottom_menu = tk.Frame(self.new_contact_frame, width=300, height=50, bg='dodgerblue3')

		self.new_contact_frame.grid(row=1, column=0)
		self.create_contact_frame.grid(row=0, column=0)
		self.bottom_menu.grid(row=1, column=0)

		self.new_contact_frame.grid_propagate(False)
		self.create_contact_frame.grid_propagate(False)
		self.bottom_menu.grid_propagate(False)

		# widgets
		self.first = tk.LabelFrame(self.create_contact_frame, text='*First Name', bg='dodgerblue3',
						width=250, height=40, fg='white')
		self.last = tk.LabelFrame(self.create_contact_frame, text='Last Name', bg='dodgerblue3',
						width=250, height=40, fg='white')
		self.phone = tk.LabelFrame(self.create_contact_frame, text='*Phone', bg='dodgerblue3',
						width=250, height=40, fg='white')
		self.email = tk.LabelFrame(self.create_contact_frame, text='Email', bg='dodgerblue3',
						width=250, height=40, fg='white')

		self.first.grid(row=0, column=0, padx=25, pady=(30,0))
		self.last.grid(row=1, column=0, padx=25, pady=(30,0))
		self.phone.grid(row=2, column=0, padx=25, pady=(30,0))
		self.email.grid(row=3, column=0, padx=25, pady=(30,0))

		self.first.grid_propagate()
		self.last.grid_propagate()
		self.phone.grid_propagate()
		self.email.grid_propagate()

		if not self.edit_contacts:
			self.first_name = tk.Label(self.first, width=33, anchor='w')
			self.last_name = tk.Label(self.last, width=33, anchor='w')
			self.phone_number = tk.Label(self.phone, width=33, anchor='w')
			self.email_id = tk.Label(self.email, width=33, anchor='w')

			self.first_name.grid(row=0, column=0)
			self.last_name.grid(row=0, column=0)
			self.phone_number.grid(row=0, column=0)
			self.email_id.grid(row=0, column=0)

			self.back = tk.Button(self.bottom_menu, image=back_icon, bg='dodgerblue3',
								relief=tk.FLAT, command=self.go_back)
			self.copy = tk.Button(self.bottom_menu, image=copy_icon, bg='dodgerblue3',
								relief=tk.FLAT, command=self.copy_contact)
			self.edit = tk.Button(self.bottom_menu, image=edit_icon, bg='dodgerblue3',
								relief=tk.FLAT, command=self.edit_contact)
			self.delete = tk.Button(self.bottom_menu, image=delete_icon, bg='dodgerblue3',
								relief=tk.FLAT, command=self.delete_contact)

			self.back.grid(row=0, column=0, padx=(10,0), pady=4)
			self.copy.grid(row=0, column=1, padx=(40,0), pady=4)
			self.edit.grid(row=0, column=2, padx=(40,0), pady=4)
			self.delete.grid(row=0, column=3, padx=(40,0), pady=4)
		else:
			self.first_name = CustomEntry(self.first, width=39)
			self.last_name = tk.Entry(self.last, width=39)
			self.phone_number = CustomPhone(self.phone, width=39)
			self.email_id = tk.Entry(self.email, width=39)

			self.first_name.focus_set()

			self.first_name.grid(row=0, column=0)
			self.last_name.grid(row=0, column=0)
			self.phone_number.grid(row=0, column=0)
			self.email_id.grid(row=0, column=0)

			self.cancel = tk.Button(self.bottom_menu, image=cancel_icon, bg='dodgerblue3',
								relief=tk.FLAT, command=self.go_back)
			self.save_contact = tk.Button(self.bottom_menu, image=save_icon, bg='dodgerblue3',
								relief=tk.FLAT, activebackground='dodgerblue3',
								command=self.save_contact_in_db)

			self.cancel.grid(row=0, column=0, padx=5)
			self.save_contact.grid(row=0, column=1, padx=180)