[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"doc-seo-759569-105":3,"detail-sidebar-cat-0-en-105":79,"doc-detail-759569-en":129,"doc-similar-759569":160},{"code":4,"msg":5,"data":6},0,"ok",{"site_id":7,"language":8,"slug":9,"title":10,"keywords":11,"description":12,"schema_data":13,"social_meta":72,"head_meta":74,"extra_data":76,"updated_unix":78},105,"en","text-viewer-markdown","TEXT VIEWER - MARKDOWN","","Learn to build a simple word processor that cleanly renders paragraphs and highlights bold and italic words. Lesson 1 focuses on displaying text using Python’s tkinter graphics window, covering window and canvas setup, font configuration, coordinate systems, and the create_text and bbox methods. Activity 1 guides a step-by-step implementation for background boxes, multiple fonts, and helper functions for measuring and selecting fonts. Lesson 2 introduces Markdown syntax and shows how to parse simplified headings, lists, and rich text markers for display.",{"@graph":14,"@context":71},[15,34,54],{"@type":16,"itemListElement":17},"BreadcrumbList",[18,23,27,31],{"item":19,"name":20,"@type":21,"position":22},"https://docshare.wps.com","Home","ListItem",1,{"item":24,"name":25,"@type":21,"position":26},"https://docshare.wps.com/document/","Document",2,{"item":28,"name":29,"@type":21,"position":30},"https://docshare.wps.com/document/technology/","Technology",3,{"item":32,"name":10,"@type":21,"position":33},"https://docshare.wps.com/document/text-viewer-markdown/759569/",4,{"url":32,"name":10,"@type":35,"image":36,"author":41,"headline":10,"publisher":44,"fileFormat":47,"inLanguage":8,"description":12,"dateModified":48,"datePublished":48,"encodingFormat":47,"isAccessibleForFree":49,"interactionStatistic":50},"DigitalDocument",{"url":37,"@type":38,"width":39,"height":40},"https://docshare.wps.com/thumbnails/text-viewer-markdown/759569.png","ImageObject",300,407,{"name":42,"@type":43},"Bulrr","Person",{"url":19,"name":45,"@type":46},"DocShare","Organization","application/pdf","2026-11-28",true,{"@type":51,"interactionType":52,"userInteractionCount":22},"InteractionCounter",{"@type":53},"ViewAction",{"@type":55,"mainEntity":56},"FAQPage",[57,63,67],{"name":58,"@type":59,"acceptedAnswer":60},"What is the main goal of the text viewer project?","Question",{"text":61,"@type":62},"To program a simple word processor that displays paragraphs clearly and highlights words in bold and italics.","Answer",{"name":64,"@type":59,"acceptedAnswer":65},"Which tkinter methods are used to position and measure text?",{"text":66,"@type":62},"The canvas.create_text() command displays text, and canvas.bbox(myobject) returns the rectangle coordinates for measuring text.",{"name":68,"@type":59,"acceptedAnswer":69},"How does the simplified Markdown syntax represent titles and lists?",{"text":70,"@type":62},"A title starts with #, a subtitle starts with ##, and list items start with +.","https://schema.org",{"og:url":32,"og:type":73,"og:title":10,"og:site_name":45,"og:description":12},"article",{"robots":75,"canonical":32},"index,follow",{"doc_id":77,"site_id":7},759569,1795888135,{"code":4,"msg":80,"data":81},"success",[82,86,90,94,99,103,108,113,118,121,125],{"id":22,"doc_module":4,"doc_module_name":25,"category_name":83,"show_sort_weight":84,"slug":85},"Story & Novel",90,"story-novel",{"id":26,"doc_module":4,"doc_module_name":25,"category_name":87,"show_sort_weight":88,"slug":89},"Literature",80,"literature",{"id":33,"doc_module":4,"doc_module_name":25,"category_name":91,"show_sort_weight":92,"slug":93},"Exam",70,"exam",{"id":95,"doc_module":4,"doc_module_name":25,"category_name":96,"show_sort_weight":97,"slug":98},5,"Comic",60,"comic",{"id":100,"doc_module":4,"doc_module_name":25,"category_name":29,"show_sort_weight":101,"slug":102},6,50,"technology",{"id":104,"doc_module":4,"doc_module_name":25,"category_name":105,"show_sort_weight":106,"slug":107},7,"Healthcare",40,"healthcare",{"id":109,"doc_module":4,"doc_module_name":25,"category_name":110,"show_sort_weight":111,"slug":112},8,"Research & Report",30,"research-report",{"id":114,"doc_module":4,"doc_module_name":25,"category_name":115,"show_sort_weight":116,"slug":117},9,"Religion & Spirituality",20,"religion-spirituality",{"id":116,"doc_module":4,"doc_module_name":25,"category_name":119,"show_sort_weight":116,"slug":120},"World Cup","world-cup",{"id":122,"doc_module":4,"doc_module_name":25,"category_name":123,"show_sort_weight":122,"slug":124},10,"Lifestyle","lifestyle",{"id":126,"doc_module":4,"doc_module_name":25,"category_name":127,"show_sort_weight":95,"slug":128},19,"General","general",{"code":4,"msg":80,"data":130},{"doc_id":77,"user_id":131,"nickname":42,"user_avatar":132,"doc_module":4,"category_id":100,"category_name":29,"doc_title":10,"doc_description":12,"doc_content":133,"file_id":134,"file_url":135,"file_type":136,"file_size":137,"view_count":22,"is_deleted":4,"is_public":22,"is_downloadable":22,"audit_status":22,"page_count":104,"language":138,"language_code":8,"site_id":7,"html_lang":8,"table_of_contents":139,"faqs":140,"seo_title":141,"seo_description":12,"update_tm":78,"read_time":142,"preview_page_count":33,"preview_urls":143},5909892115043,"https://ap-avatar.wpscdn.com/davatar_6f874abed73319feea01a86fa6f0fab8","Text viewer – Markdown  \nYou will program a simple word processor that displays paragraphs cleanly and highlights words in bold and italics.  \nLesson 1 (Text with tkinter).  \nHere's how to display text with Python and the graphics window module tkinter.  \nThe code is:  \nfrom tkinter import *  \nfrom tkinter .font import Font  \n\\# tkinter window  \nroot = Tk()  \ncanvas = Canvas(root, width=800, height=600, background=\"white\")  \ncanvas .pack(fill=\"both\", expand=True)  \n\\# Font  \nmyfont = Font(family=\"Times\", size=30)  \n\\# Some text  \ncanvas .create_text(100,100, text=\"Text with Python!\", anchor=SW, font=myfont, fill=\"blue\")  \n\\# Launch the window  \nroot .mainloop()  \nSome explanations:  \n• root and canvas are the variables that deﬁne a graphic window (here of width 800 and height 600 pixels) . This window is launched by the last command: root .mainloop() .  \n• We remind you that for the graphic coordinates, the y-axis is directed downwards and the origin is the top-left corner. To deﬁne a rectangle, simply specify the coordinates (x 1 , y 1) and (x2 , y 2) from two opposite vertices (see ﬁgure below) .  \n• The text is displayed by the canvas .create_text() command. It is necessary to specify the coordinates (x , y ) of the point from which you want to display the text.  \n• The text option allows you to pass the string to display.  \n• The anchor option allows you to specify the text anchor point, anchor=SW means that the text box is anchored to the Southwest point (SW) (see ﬁgure below) .  \nTEXT VIEWER – MARKDOWN 2  \n• The fill option allows you to specify the text color.  \n• The option font allows you to deﬁne the font (i.e. the style and size of the characters) . Here are some examples of fonts, it's up to you to test them:  \n– Font(family=\"Times\", size=20)  \n– Font(family=\"Courier\", size=16, weight=\"bold\") in bold  \n– Font(family=\"Helvetica\", size=16, slant=\"italic\") in italics  \n(0, 0)  \ny  \n(x 1 , y1)  \nx  \nSouth West anchor  \n(x2 , y2)  \nActivity 1 (Display a text with tkinter).  \nGoal: display text with the graphics module tkinter.  \n1. (a) Deﬁne a tkinter window of size 800 􀀂 600 for example.  \n(b) Draw a gray rectangle (which will be our background box) with a size of back_width 􀀂 back_height (for example 700 􀀂 500) .  \n(c) Deﬁne several types of fonts: title_font, subtitle_font, bold_font, italic_font, text_font.  \n(d) Display texts with different fonts.  \n2. Write a text_box(word,font) function that draws a rectangle around a text. To do this, use the canvas .bbox(myobject) method which returns the x 1 , y 1 , x2 , y 2 coordinates of the desired rectangle. (Here myobject = canvas .create_text( . . .)) .  \n3. Write a length_word(word,font) function that calculates the length of a word in pixels (this is the width of the rectangle from the previous question) .  \n4. Write a font_choice(mode,in_bold,in_italics) function that returns the name of an adapted font (among those deﬁned in the ﬁrst question) according to a mode (among \"title\" ,\"subtitle\" , \"text\") and according to booleans in_bold, in_italics.  \nFor example, font_choice(\"text\",True,False) returns the font bold_font.  \nLesson 2 (Markdown).  \nThe Markdown is a simple markup language that allows you to write your own easy to read text ﬁle and possibly convert it to another format (html, pdf. . . ) .  \nTEXT VIEWER – MARKDOWN 3  \nHere is an example of a text ﬁle with the Markdown syntax with its graphic rendering just below.  \n\\# On the Origins of Species  \n\\#\\# by Charles Darwin  \nWhen on board H.M.S . * Beagle * as naturalist, I was much struck with certain facts in the distribution of the inhabitants of South America, and in the geological relations of the present to the past inhabitants of that continent . These facts seemed to me to throw some light on the  \n** origin of species ** that mystery of mysteries, as it has been called by one of our greatest philosophers .  \n\\#\\# Chapters  \n+ Variation under domestication .  \n+ Variation under nature .  \n+ Struggle for e","cbCaij0DBsKrSQIl","https://ap.wps.com/l/cbCaij0DBsKrSQIl","pdf",261494,"English","# Lesson 1 (Text with tkinter)\n## Display text with tkinter\n## Activity 1 (Display a text with tkinter)\n# Lesson 2 (Markdown)\n## Markdown syntax and examples\n## Activity 2 (View Markdown)\n## Activity 3 (View Markdown): bold and italics","[{\"question\":\"What is the main goal of the text viewer project?\",\"answer\":\"To program a simple word processor that displays paragraphs clearly and highlights words in bold and italics.\"},{\"question\":\"Which tkinter methods are used to position and measure text?\",\"answer\":\"The canvas.create_text() command displays text, and canvas.bbox(myobject) returns the rectangle coordinates for measuring text.\"},{\"question\":\"How does the simplified Markdown syntax represent titles and lists?\",\"answer\":\"A title starts with #, a subtitle starts with ##, and list items start with +.\"}]","TEXT VIEWER - MARKDOWN | PDF",18,[144,148,152,156],{"page_no":22,"url":145,"width":146,"height":147},"https://res-academy.cache.wpscdn.com/upload/kdocshare/2026-11-28/efa5fe688f6b9811910e1c5bffa0b8ad.webp",983,1390,{"page_no":26,"url":149,"width":150,"height":151},"https://res-academy.cache.wpscdn.com/upload/kdocshare/2026-11-28/6d26eff26f0409cfecfb2c0e7daf5a86.webp",982,1388,{"page_no":30,"url":153,"width":154,"height":155},"https://res-academy.cache.wpscdn.com/upload/kdocshare/2026-11-28/cf8de50f5000d79e498846ca3056ef1f.webp",981,1387,{"page_no":33,"url":157,"width":158,"height":159},"https://res-academy.cache.wpscdn.com/upload/kdocshare/2026-11-28/1cd03dcbd91df9d5800039f90d944926.webp",980,1385,{"list":161,"token":11},[162,168,175,181,187,193,200,207,213,220],{"doc_id":163,"doc_title":164,"file_type":136,"home_preview_img_url":165,"slug":166,"view_count":95,"category_name":29,"create_tm":167},698003,"md4r - R package Markdown parser using the MD4C library","https://weboffice-temporary-prod-sg.obs.ap-southeast-3.myhuaweicloud.com:443/export/thumbnail/export/thumbnail/110230010155849/last/300/407?AWSAccessKeyId=HPUAE6OPDRI9QZXR6WJG&Expires=1796111639&Signature=AhD0iAh6IN1BSkQhH8RtZp7aqqI%3D","md4r-r-package-markdown-parser-using-the-md4c-library",1794446945,{"doc_id":169,"doc_title":170,"file_type":136,"home_preview_img_url":171,"slug":172,"view_count":173,"category_name":29,"create_tm":174},348238,"Markdown Cheat Sheet - Every common Markdown syntax in one page","https://weboffice-temporary-prod-sg.obs.ap-southeast-3.myhuaweicloud.com:443/export/thumbnail/export/thumbnail/110229911603538/last/300/407?AWSAccessKeyId=HPUAE6OPDRI9QZXR6WJG&Expires=1796111639&Signature=U%2FnI%2F474tUldNkMVYG%2B7HyrpAgY%3D","markdown-cheat-sheet-every-common-markdown-syntax-in-one-page",15,1790071906,{"doc_id":176,"doc_title":177,"file_type":136,"home_preview_img_url":178,"slug":179,"view_count":122,"category_name":29,"create_tm":180},657500,"CS&SS 569 Visualizing Data and Models - Lab 2 - Intro to LATEX with R Markdown and Overleaf","https://weboffice-temporary-prod-sg.obs.ap-southeast-3.myhuaweicloud.com:443/export/thumbnail/export/thumbnail/110229975094700/last/300/407?AWSAccessKeyId=HPUAE6OPDRI9QZXR6WJG&Expires=1796111639&Signature=CXcUoW9AoPBgu7DIfZHQ6FePFDk%3D","csss-569-visualizing-data-and-models-lab-2-intro-to-latex-with-r-markdown-and-overleaf",1792981475,{"doc_id":182,"doc_title":183,"file_type":136,"home_preview_img_url":184,"slug":185,"view_count":33,"category_name":29,"create_tm":186},697999,"gluedown - Title Wrap Vectors in Markdown Formatting Version 1.0.9 - Package description and R functions","https://weboffice-temporary-prod-sg.obs.ap-southeast-3.myhuaweicloud.com:443/export/thumbnail/export/thumbnail/110230010155709/last/300/407?AWSAccessKeyId=HPUAE6OPDRI9QZXR6WJG&Expires=1796111639&Signature=rXIcw7IH80DQwOCI95OktIu24F4%3D","gluedown-title-wrap-vectors-in-markdown-formatting-version-109-package-description-and-r-functions",1794446933,{"doc_id":188,"doc_title":189,"file_type":136,"home_preview_img_url":190,"slug":191,"view_count":114,"category_name":29,"create_tm":192},678102,"Obsidian Markdown Cheat Sheet","https://weboffice-temporary-prod-sg.obs.ap-southeast-3.myhuaweicloud.com:443/export/thumbnail/export/thumbnail/110229994560354/last/300/407?AWSAccessKeyId=HPUAE6OPDRI9QZXR6WJG&Expires=1796111639&Signature=h2ZJwBYZHqZPrOb1PBHx9QB7s%2B8%3D","obsidian-markdown-cheat-sheet",1793784222,{"doc_id":194,"doc_title":195,"file_type":136,"home_preview_img_url":196,"slug":197,"view_count":198,"category_name":29,"create_tm":199},348234,"Markdown Syntax - Cheat Sheet","https://weboffice-temporary-prod-sg.obs.ap-southeast-3.myhuaweicloud.com:443/export/thumbnail/export/thumbnail/110229911078253/last/300/407?AWSAccessKeyId=HPUAE6OPDRI9QZXR6WJG&Expires=1796111639&Signature=kpGGkBtSuITgJAFeviCariVAWgE%3D","markdown-syntax-cheat-sheet",16,1790071896,{"doc_id":201,"doc_title":202,"file_type":136,"home_preview_img_url":203,"slug":204,"view_count":205,"category_name":29,"create_tm":206},348231,"Markdown Cheatsheet","https://weboffice-temporary-prod-sg.obs.ap-southeast-3.myhuaweicloud.com:443/export/thumbnail/export/thumbnail/110229911603533/last/300/407?AWSAccessKeyId=HPUAE6OPDRI9QZXR6WJG&Expires=1796111639&Signature=eYdKnlOxT3INTs%2F5ALcueVgt74I%3D","markdown-cheatsheet",14,1790071893,{"doc_id":208,"doc_title":209,"file_type":136,"home_preview_img_url":210,"slug":211,"view_count":95,"category_name":29,"create_tm":212},685841,"Markdown Syntax Guide - Quick Reference","https://weboffice-temporary-prod-sg.obs.ap-southeast-3.myhuaweicloud.com:443/export/thumbnail/export/thumbnail/110230000227664/last/300/407?AWSAccessKeyId=HPUAE6OPDRI9QZXR6WJG&Expires=1796111639&Signature=9Cwu0vAcNdGrokheqXXqlFUEi8E%3D","markdown-syntax-guide-quick-reference",1794019531,{"doc_id":214,"doc_title":215,"file_type":136,"home_preview_img_url":216,"slug":217,"view_count":218,"category_name":29,"create_tm":219},348236,"Introduction to Markdown - Guide","https://weboffice-temporary-prod-sg.obs.ap-southeast-3.myhuaweicloud.com:443/export/thumbnail/export/thumbnail/110229911078271/last/300/407?AWSAccessKeyId=HPUAE6OPDRI9QZXR6WJG&Expires=1796111639&Signature=18I7wbSgnHPVzBL7VMxDHGtzeA4%3D","introduction-to-markdown-guide",21,1790071903,{"doc_id":221,"doc_title":222,"file_type":136,"home_preview_img_url":223,"slug":224,"view_count":33,"category_name":29,"create_tm":225},697998,"Markdown cheat sheet - guide","https://weboffice-temporary-prod-sg.obs.ap-southeast-3.myhuaweicloud.com:443/export/thumbnail/export/thumbnail/110230010155625/last/300/407?AWSAccessKeyId=HPUAE6OPDRI9QZXR6WJG&Expires=1796111639&Signature=DSlVxnHcd3LgUmnpZwqtRNahNKI%3D","markdown-cheat-sheet-guide",1794446932]