keropplease.blogg.se

Basic python text editor
Basic python text editor




basic python text editor

The width of the widget in characters (not pixels!), measured according to the current font size.

basic python text editor

This option controls how tab characters position text. If you set state=DISABLED, the text widget will not respond, and you won't be able to modify its contents programmatically either. Normally, text widgets respond to keyboard and mouse events set state=NORMAL to get this behavior. If a line wraps, this space is added only after the last line it occupies on the display. This option specifies how much extra vertical space is added below each line of text. This option specifies how much extra vertical space to add between displayed lines of text when a logical line wraps. If a line wraps, this space is added only before the first line it occupies on the display. This option specifies how much extra vertical space is put above each line of text. The width of the border to use around selected text. The background color to use displaying selected text. The size of the internal padding added above and below the text area. The size of the internal padding added to the left and right of the text area. Width of the insertion cursor (its height is determined by the tallest item in its line). The number of milliseconds the insertion cursor is on during its blink cycle. Set this option to zero to suppress blinking. The number of milliseconds the insertion cursor is off during its blink cycle. Size of the 3-D border around the insertion cursor. Set highlightthickness=0 to suppress display of the focus highlight. The color of the focus highlight when the text widget has the focus. The color of the focus highlight when the text widget does not have focus. The height of the widget in lines (not pixels!), measured according to the current font size.

basic python text editor

You can change the color for tagged regions this option is just the default. The color used for text (and bitmaps) within the widget. The default font for text inserted into the widget. Set exportselection=0 if you don't want that behavior. Normally, text selected within a text widget is exported to be the selection in the window manager. The cursor that will appear when the mouse is over the text widget. The width of the border around the text widget. The default background color of the text widget. These options can be used as key-value pairs separated by commas. Options − Here is the list of most commonly used options for this widget. Master − This represents the parent window. Here is the simple syntax to create this widget −

BASIC PYTHON TEXT EDITOR WINDOWS

Moreover, you can embed windows and images in the text because this widget was designed to handle both plain and formatted text. You can also use elegant structures like tabs and marks to locate specific sections of the text, and apply changes to those areas.

basic python text editor

If you want more tutorials like this tell me what here.įull Code: import sys v=sys.version() if "2.7" in v: from Tkinter import * import tkFileDialog elif "3.3" in v or "3.4" in v: from tkinter import * import tkinter.tkFileDialog root=Tk("Text Editor") text=Text(root) id() def saveas(): global text t = text.get("1.0", "end-1c") savelocation=tkFileDialog.asksaveasfilename() file1=open(savelocation, "w+") file1.write(t) file1.close() button=Button(root, text="Save", command=saveas) id() def FontHelvetica(): global text nfig(font="Helvetica") def FontCourier(): global text nfig(font="Courier") font=Menubutton(root, text="Font") id() nu=Menu(font, tearoff=0) font=nu Helvetica=IntVar() arial=IntVar() times=IntVar() Courier=IntVar() _checkbutton(label="Courier", variable=Courier, command=FontCourier) _checkbutton(label="Helvetica", variable=helvetica, command=FontHelvetica) root.Text widgets provide advanced capabilities that allow you to edit a multiline text and format the way it has to be displayed, such as changing its color and font. Under the last line you added, add this: def FontHelvetica(): global text nfig(font="Helvetica") def FontCourier(): global text nfig(font="Courier") font=Menubutton(root, text="Font") id() nu=Menu(font, tearoff=0) font=nu helvetica=IntVar() courier=IntVar() _checkbutton(label="Courier", variable=courier, command=FontCourier) _checkbutton(label="Helvetica", variable=helvetica, command=FontHelvetica)Ĭongratulations! You have finished a very simple text editor.






Basic python text editor