-
Notifications
You must be signed in to change notification settings - Fork 0
/
main_EntryValidate.py
62 lines (41 loc) · 2.18 KB
/
main_EntryValidate.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
"""This Script is used for testing Tkinter Entry object extension custom widget."""
import tkinter as tk
from tkinter import ttk
import clsStatusBar as status_bar
import clsValidateData as validate
import wgtEntryWithEvents as myWidgetEntryWithEvents
root = tk.Tk()
root.geometry("400x400")
# first always create the status bar
sbar = status_bar.status_bar_obj(root,default_text= "Ready",text="Loading...")
val = validate.validate(statusBarObj= sbar)
""" Initial an implementation of ttk.Entry with Events, Validation and Formatting """
EntryWithEvents = myWidgetEntryWithEvents.EntryWithEvents
entry_date = EntryWithEvents(master= root, max_len = 11, widget_name = 'entry_date',
validation_method = val.validate_Date,
set_justifiction = tk.LEFT,
tool_tip = 'Enter a date or a date shortcut!')
entry_date.pack(expand=True)
entry_details = EntryWithEvents(master=root, max_len = 11, widget_name = 'entry_detail',
validation_method = val.validate_Date)
entry_details.pack(expand=True)
entry_float = EntryWithEvents(master=root, max_len = 15, widget_name = 'entry_float',
validation_method = val.validate_float)
entry_float.pack(expand=True)
entry_decimal = EntryWithEvents(master=root, max_len = 15, widget_name = 'entry_decimal',
validation_method = val.validate_decimal)
entry_decimal.pack(expand=True)
entry_integer = EntryWithEvents(master=root, max_len = 15, widget_name = 'entry_integer',
validation_method = val.validate_integer)
entry_integer.pack(expand=True)
entry_title = EntryWithEvents(master=root, widget_name = 'entry_title',
validation_method = val.validate_title)
entry_title.pack(expand=True)
entry_sentence = EntryWithEvents(master=root, widget_name = 'entry_sentence',
validation_method = val.validate_sentence)
entry_sentence.pack(expand=True)
# set focus to the field we want.
root.after(1, lambda: entry_date.focus_set())
sbar.update()
root.title("Testing") # My Widget - Entry With Events")
root.mainloop()