# Path: ui/TooltipEntry.py
# class TooltipEntry(Entry):
#     def __init__(self, parent, *args, **kw):
#         Entry.__init__(self, parent, *args, **kw)
# 
#         self.tooltip = Tooltip2(self, waittime=0, text='', bg='white')  #, pad=(0, 0, 0, 0))
# 
#     def showTooltip(self, text=None, pos=None):
#         self.tooltip.show(text, pos)
# 
#     def hideTooltip(self):
#         self.tooltip.hide()
# 
#     def destroy(self):
#         self.tooltip.hide()
#         super().destroy()
# 
# TIP_BELOW = 'below'


from tkinter.ttk import Treeview, Entry, Combobox
from tkinter.constants import *
from ui.TooltipEntry import TooltipEntry, TIP_BELOW
    from tkinter import Tk
    from tkinter.constants import *
import re
    # def yview_scroll(self, number, what):
    #     self.on_entry_close()
    #     super().yview_scroll(number, what)
    #
    # def xview_moveto(self, fraction):
    #     self.on_entry_close()
    #     super().xview_moveto(fraction)
    #
    # def yview_moveto(self, fraction):
    #     self.on_entry_close()
    #     super().yview_moveto(fraction)


if __name__ == '__main__':

    root = Tk()
    tree = EditableTreeview(root)
    tree.pack()

    tree['columns'] = ('Title', 'Item Price', 'Filter Price', 'Filter Force State')

    def validate_price(widget):
        valid = widget.get() == '100 chaos' or widget.get() == ''
        if not valid:
            widget.showTooltip('Invalid price', TIP_BELOW)
            widget.focus()
        else:
            widget.hideTooltip()
        return valid


# Path: ui/TooltipEntry.py
# class TooltipEntry(Entry):
#     def __init__(self, parent, *args, **kw):
#         Entry.__init__(self, parent, *args, **kw)
# 
#         self.tooltip = Tooltip2(self, waittime=0, text='', bg='white')  #, pad=(0, 0, 0, 0))
# 
#     def showTooltip(self, text=None, pos=None):
#         self.tooltip.show(text, pos)
# 
#     def hideTooltip(self):
#         self.tooltip.hide()
# 
#     def destroy(self):
#         self.tooltip.hide()
#         super().destroy()
# 
# TIP_BELOW = 'below'


# Path: ui/MyTreeview.py
from tkinter.ttk import Treeview, Entry, Combobox
from tkinter.constants import *
from ui.TooltipEntry import TooltipEntry, TIP_BELOW
    from tkinter import Tk
    from tkinter.constants import *
import re

    # def yview_scroll(self, number, what):
    #     self.on_entry_close()
    #     super().yview_scroll(number, what)
    #
    # def xview_moveto(self, fraction):
    #     self.on_entry_close()
    #     super().xview_moveto(fraction)
    #
    # def yview_moveto(self, fraction):
    #     self.on_entry_close()
    #     super().yview_moveto(fraction)


if __name__ == '__main__':

    root = Tk()
    tree = EditableTreeview(root)
    tree.pack()

    tree['columns'] = ('Title', 'Item Price', 'Filter Price', 'Filter Force State')

    def validate_price(widget):
        valid = widget.get() == '100 chaos' or widget.get() == ''
        if not valid:
            widget.showTooltip('Invalid price', TIP_BELOW)
            widget.focus()
        else:
            widget.hideTooltip()
        return valid


    cent_iprice = EditableTreeview.ColEntry(TooltipEntry(tree), func_validate=validate_price)