こんにちは、@yasuです。 今回はメモ帳っぽいもの作りながら学習してみたいと思います。 * 今回、テキストを保存するファイル名は固定 * テキストにスクールバーをつける * メニューをつける ### 実行環境 * https://repl.it/ ではなく Visual Studio Codeで行います * tkinterライブラリ使用 ### コード ``` import os from tkinter import * root = Tk() root.title("メモ帳っぽいもの") root.geometry("640x400") filename = "mynote.txt" def open_file (): if os.path.isfile(filename): with open(filename, "r",encoding="utf8") as file: txt.delete("1.0",END) txt.insert(END, file.read()) def save_file (): with open(filename, "w",encoding="utf8") as file: file.write(txt.get("1.0",END)) menu = Menu(root) menu_file = Menu(menu, tearoff=0) menu_file.add_command(label = "開く", command=open_file) menu_file.add_command(label = "保存", command=save_file) menu_file.add_separator() menu_file.add_command(label = "終了", command=root.quit) menu.add_cascade(label="ファイル", menu=menu_file) menu.add_cascade(label="編集") menu.add_cascade(label="書式") menu.add_cascade(label="表示") menu.add_cascade(label="ヘルプ") #スクロールバー scrollbar = Scrollbar(root) scrollbar.pack(side="right",fill="y") txt = Text(root, yscrollcommand=scrollbar.set) txt.pack(side="left",fill="both",expand = True) scrollbar.config(command=txt.yview) root.config(menu=menu) root.mainloop() ``` ### 実行結果 ![image.png](https://files.steempeak.com/file/steempeak/yasu/EeOdVi1Q-image.png)
post_id | 87,751,684 |
---|---|
author | yasu |
permlink | ma4xc-python |
category | hive-101145 |
json_metadata | {"tags":["jp","marlians","zzan","python","sct-jp","sct-freeboard","mini","dblog","sct"],"image":["https:\/\/files.steempeak.com\/file\/steempeak\/yasu\/EeOdVi1Q-image.png"],"app":"steemcoinpan\/0.1","format":"markdown","canonical_url":"https:\/\/www.steemcoinpan.com\/@yasu\/ma4xc-python","users":["yasu"],"links":["https:\/\/repl.it\/"]} |
created | 2020-09-30 02:03:48 |
last_update | 2020-09-30 02:08:21 |
depth | 0 |
children | 1 |
net_rshares | 59,276,123,267,242 |
last_payout | 2020-10-07 02:03:48 |
cashout_time | 1969-12-31 23:59:59 |
total_payout_value | 10.408 SBD |
curator_payout_value | 9.802 SBD |
pending_payout_value | 0.000 SBD |
promoted | 0.000 SBD |
body_length | 1,358 |
author_reputation | 1,271,875,039,650,699 |
root_title | "[Python] メモ帳っぽいもの作ってみました" |
beneficiaries | [] |
max_accepted_payout | 1,000,000.000 SBD |
percent_steem_dollars | 10,000 |
author_curate_reward | "" |
voter | weight | wgt% | rshares | pct | time |
---|---|---|---|---|---|
gerber | 0 | 3,557,637,491 | 2.6% | ||
ezzy | 0 | 140,185,554,216 | 2.6% | ||
slowwalker | 0 | 2,441,302,125 | 5% | ||
exyle | 0 | 207,425,791,144 | 2.6% | ||
oldstone | 0 | 50,426,669,943 | 5% | ||
abdullar | 0 | 39,377,859,337 | 50% | ||
allsale | 0 | 383,348,714,599 | 100% | ||
sonki999 | 0 | 411,238,449,129 | 100% | ||
virus707 | 0 | 8,127,254,996,924 | 25% | ||
ricko66 | 0 | 16,823,677,829 | 100% | ||
dine77 | 0 | 105,266,173,510 | 5.03% | ||
pixelfan | 0 | 15,474,374,288 | 2.5% | ||
leemikyung | 0 | 429,113,127,334 | 100% | ||
tookta | 0 | 64,244,330,326 | 69% | ||
make-a-whale | 0 | 13,338,120,749 | 40% | ||
thaiteam | 0 | 68,028,230,440 | 100% | ||
accelerator | 0 | 13,929,823,205 | 2.6% | ||
voxmonkey | 0 | 36,300,954 | 100% | ||
jsquare | 0 | 2,259,850,245,750 | 17% | ||
khaleelkazi | 0 | 246,571,291 | 2.6% | ||
lays | 0 | 1,030,007,423,586 | 100% | ||
mmmmkkkk311 | 0 | 775,737,617,372 | 100% | ||
nealmcspadden | 0 | 1,469,321,829 | 2.6% | ||
supergiant | 0 | 1,537,953,419,246 | 100% | ||
jsj1215 | 0 | 266,164,583,101 | 100% | ||
yasu | 0 | 504,445,268,418 | 100% | ||
adenijiadeshina | 0 | 9,167,933,911 | 50% | ||
ricardo306 | 0 | 185,784,054 | 15% | ||
josemalavem | 0 | 20,487,297,042 | 100% | ||
allnews | 0 | 8,572,112,408 | 50% | ||
mightynick | 0 | 165,296,937 | 5.62% | ||
twinpapa | 0 | 341,651,333,108 | 100% | ||
dlike | 0 | 79,728,576,991 | 6% | ||
veronicalee | 0 | 45,263,448,957 | 5% | ||
silvertop | 0 | 19,775,584,203 | 100% | ||
dcooperation | 0 | 33,546,729,443 | 50% | ||
elizabethbit | 0 | 20,158,266,096 | 100% | ||
qrater | 0 | 157,916,957 | 100% | ||
new-steemit | 0 | 13,584,427,262 | 10% | ||
glastar | 0 | 44,658,557,890 | 100% | ||
ctime | 0 | 765,584,214,554 | 100% | ||
minigame | 0 | 6,973,605,383,287 | 39.1% | ||
tomoyan | 0 | 516,816,505,634 | 100% | ||
yasu.pal | 0 | 743,488,786 | 50% | ||
lookplz | 0 | 103,679,302 | 0.8% | ||
steem.leo | 0 | 3,043,366,491 | 2.6% | ||
realmankwon.scot | 0 | 3,970,325,608 | 50% | ||
leo.voter | 0 | 139,564,026 | 2.6% | ||
sct.krwp | 0 | 2,610,997,762,326 | 5.62% | ||
ufm.pay | 0 | 6,385,224,016 | 5% | ||
maxuvd | 0 | 4,564,717,746 | 11% | ||
maxuve | 0 | 5,881,402,904 | 2.49% | ||
tmps | 0 | 2,275,862,304 | 5% | ||
minamiyololife | 0 | 699,879,031,663 | 100% | ||
brumar | 0 | 750,524,294 | 100% | ||
sct.curator | 0 | 27,665,870,122 | 31.25% | ||
inandout | 0 | 163,306,482 | 50% | ||
mcgome | 0 | 1,825,188,757 | 50% | ||
youngtopia | 0 | 47,441,893 | 50% | ||
ysm1360 | 0 | 198,095,377 | 50% | ||
realmankwon.cur | 0 | 35,116,833 | 50% | ||
dev.supporters | 0 | 239,753,212,612 | 10% | ||
gotogether | 0 | 3,300,956,038,962 | 5.46% | ||
gopower | 0 | 9,298,329,774 | 5.46% | ||
krwp.abc | 0 | 34,718,815 | 2.16% | ||
upvu | 0 | 26,982,725,888,593 | 8.52% | ||
visionaer3003 | 0 | 4,179,744,021 | 5.7% | ||
ezvote | 0 | 8,561,038,087 | 1% | ||
discohedge | 0 | 1,449,374,578 | 5% |
@yasu transfered 0.5 KRWP to @krwp.burn. voting percent : 5.62%, voting power : 62.55%, steem power : 1926827.97, STU KRW : 1200. @yasu staking status : 250 KRWP @yasu limit for KRWP voting service : 0.5 KRWP (rate : 0.002) What you sent : 0.5 KRWP [47305629 - 47e416b901ab6e91d3dc442314273d5a3087f3e2]
post_id | 87,751,728 |
---|---|
author | sct.krwp |
permlink | re--ma4xc-python-20200930t021051311z |
category | hive-101145 |
json_metadata | {"tags":["jp","marlians","zzan","python","sct-jp","sct-freeboard","mini","dblog","sct"]} |
created | 2020-09-30 02:10:57 |
last_update | 2020-09-30 02:10:57 |
depth | 1 |
children | 0 |
net_rshares | 0 |
last_payout | 2020-10-07 02:10:57 |
cashout_time | 1969-12-31 23:59:59 |
total_payout_value | 0.000 SBD |
curator_payout_value | 0.000 SBD |
pending_payout_value | 0.000 SBD |
promoted | 0.000 SBD |
body_length | 367 |
author_reputation | 10,000,000,000,000 |
root_title | "[Python] メモ帳っぽいもの作ってみました" |
beneficiaries | [] |
max_accepted_payout | 1,000,000.000 SBD |
percent_steem_dollars | 10,000 |