![]() ![]() ![]() Text.tag_config( "C", font = "Times 20 bold", foreground = "green") Text.insert( "end", "This is in Font consolas 12 overstrike. Text.tag_config( "B", font = "Consolas 12 overstrike", foreground = "Blue") Text.insert( "end", "This is in Font consolas 12 italic. Text.tag_config( "A", font = "Consolas 12 italic", foreground = "red") # Apply tag name with insert(pos, message, tag) format # Use tag_config to define all required attributes id(row = 0, column = 0, sticky = tk.NSEW) MenuBar.add_cascade(label="Help", menu=HelpMenu)Ĭreating fonts, colors with various styles is achieved by creating tag names and defining tag attributes to them, then using those tag names when inserting text into Text object. HelpMenu.add_command(label="About", command=info) ![]() MenuBar.add_cascade(label="Edit", menu=EditMenu) MenuBar.add_cascade(label="File", menu=FileMenu)ĮditMenu.add_command(label="Cut", command=cut)ĮditMenu.add_command(label="Copy", command=copy)ĮditMenu.add_command(label="Paste", command=paste)ĮditMenu.add_command(label="Font Size", command=changeSizeWindow)ĮditMenu.add_command(label="Font Style", command=paste) TextArea = Text(root, font=f"lucida ", yscrollcommand=t)įileMenu.add_command(label="New File", command=newFile)įileMenu.add_command(label="Open File", command=openFile)įileMenu.add_command(label="Save", command=save)įileMenu.add_command(label="Quit", command=quitFile) Label(TextSize, text="Enter the font size you want:", font="lucida 15 bold").pack()Įntry(TextSize, textvariable=size, font="lucida 15").pack(padx=40)īutton(TextSize, text="Apply", command=changeSize).pack() Root.title(os.path.basename(file) + " - Notepad")įile = asksaveasfilename(initialfile="Untitled.txt", defaultextension=".txt", filetypes=) Please help me out.įrom tkinter.filedialog import askopenfilename, asksaveasfilenameįile = askopenfilename(defaultextension=".txt", filetypes=) I have also tried methods like file handling but it doesn't work. My notepad is fully made up with python's tkinter module. ![]() I have tried various options but they have failed. I want to create a feature which can change the font size and also the font style. ![]()
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |