This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
###Changing the colour of selected text in Tkinter Text wiget### | |
from tkinter import * | |
from tkinter import ttk | |
root = Tk( ) | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
###Using a variable in a function from outside the function### | |
###Returning a value from a function to be used outside the function.### | |
# Returns a string in lowercase | |
def Make_Lowercase(cmt): | |
cmt = cmt.lower() | |
return cmt | |
comment = "My name is SCOTT." | |
print ("Commment without lowercase formatting:") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
###Removing Unwanted Whitespace In A String### | |
Comment_1 = " How are you? " | |
Comment_2 = " How are you? " | |
def remove_whitespace_either_side(comment): | |
comment = comment.strip() | |
print(comment) | |
def remove_any_duplicated_white_space(comment): | |
comment = " ".join(comment.split()) | |
print (comment) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
###Tkinter Scrolling with Text### | |
'''Make text scroll to the bottom of the text box as new entries appear''' | |
from tkinter import * | |
from tkinter.scrolledtext import * | |
window = Tk() |
NewerOlder