Skip to content

Latest commit

 

History

History
105 lines (65 loc) · 2.76 KB

dbpp.widgets.sqltext.md

File metadata and controls

105 lines (65 loc) · 2.76 KB

dbpp.widgets package: GuiBaseClass - AutoScrollbar - Balloon - Ctext - LabEntry - RoText - Scrolled - SqlText - StatusBar - TableView - TextMixins - XTableView - XTreeView

dbpp.kroki - dbpp.kroki.KrokiEncoder - dbpp.utils - dbpp.utils.SqlUtils -

apps: dbpp.peditor

module widgets.sqltext

SQL syntax aware text widdget with syntax highlighting

This is a Ctext based Text widget which supports SQL syntax for highlighting SQL code.

Examples:

import tkinter as tk
from dbpp.widgets.sqltext import SqlText
root= tk.Tk()   
ctext = SqlText(root,background='gray90',border=5,relief='flat') 
root.title('SqlText example') 
ctext.pack(side='top',fill='both',expand=True)  
ctext.insert("end", "select * from sample where id == '1' or id == 'Hello'

-- a comment
 new statement
/*
c-style comment passing
 multiple lines
*/")
ctext.highlight('1.0','end')

# just sample execution on ctrl-enter
def bindExample(evt=None,widget=None):
     print(widget.get('1.0','end'))
     return("break")

ctext.bind('<Control-Return>',lambda evt: bindExample(widget=ctext))

root.mainloop()

class SqlText

Python wrapper for the Tklib ctext widget which supports SQL highlighting.

All options and methods of the Ctext widget and the tk.Text widget are supported.

method __init__

__init__(master=None, cnf={}, **kwargs)

Initialize the wrapper widget.

Args:

  • master (ttk.Frame): the parent widget, usually a ttk.Frame, if not given the toplevel is choosen, default: None
  • cnf, **kwargs (dict): options delegated to the Ctext and tk.Text widget

This file was automatically generated via lazydocs.