質問をすることでしか得られない、回答やアドバイスがある。

15分調べてもわからないことは、質問しよう!

新規登録して質問してみよう
ただいま回答率
85.48%
Python 3.x

Python 3はPythonプログラミング言語の最新バージョンであり、2008年12月3日にリリースされました。

Tkinter

Tkinterは、GUIツールキットである“Tk”をPythonから利用できるようにした標準ライブラリである。

Q&A

0回答

383閲覧

tkinter の after method の使い方が分からない

Kivy

Kivy

総合スコア4

Python 3.x

Python 3はPythonプログラミング言語の最新バージョンであり、2008年12月3日にリリースされました。

Tkinter

Tkinterは、GUIツールキットである“Tk”をPythonから利用できるようにした標準ライブラリである。

0グッド

0クリップ

投稿2019/09/26 02:19

import os
import json as js
from bs4 import BeautifulSoup as bs
import requests as req
import tkinter as tk
import sys
import random
import time

Initial Setting

path = os.path.dirname(file)
os.makedirs('db', exist_ok=True)
os.makedirs('local', exist_ok=True)

modoru = ['hoge', 'hoge', 'hoge']

def modoru():
if not modoru:
return
tel_len = 0
while not(10 == tel_len or 11 == tel_len):
#print("Please enter a telephone number. (Without -)")
tel = modoru
tel_len = len(tel)
if 10 == tel_len:
tel_db = tel[1]
tel_db_key = tel[0:6]
tel_db_path = str(path) + "/db/tnum-" + tel_db + ".json"
file_01 = open(tel_db_path, encoding='utf-8')
tel_db_j = js.load(file_01)
tel_left = tel_db_j[tel_db_key]["TNout"]
tel_center = tel_db_j[tel_db_key]["TNins"]
tel_location = tel_db_j[tel_db_key]["Location"]
tel_right = tel[6:10]
if 11 == tel_len:
tel_left = tel[0:3]
tel_center = tel[3:7]
tel_right = tel[7:11]
tel_location = "Unknown"
url = "numberinfo_" + tel_left + "" + tel_center + "" + tel_right + ".html"
# print( "\n" + tel_left + "-" + tel_center + "-" + tel_right + "について情報を検索中...")
# print("発信: " + tel_location + "\n" )

# Collecting html = open( str(path) + '/local/' + url,encoding='utf-8') # Parsing pars = bs(html, 'html.parser') data_who = "" data_how = "" data_location = "" data_raw_detail = pars.find_all('td', class_ = 'autonewline') data_raw_detail_len = len(data_raw_detail) if 0 < data_raw_detail_len: data_who = data_raw_detail[0].text data_how = data_raw_detail[1].text data_location = data_raw_detail[2].text print("名称: " + data_who) print("業種: " + data_how) print("住所: " + data_location) root = tk.Tk() label1 = tk.Label(root, text="番号:" + tel_left + "-" + tel_center + "-" + tel_right, font=("",20)) label1.place(x=0,y=0) label2 = tk.Label(root, text="名称:" + data_who , font=("",20)) label2.place(x=100,y=100) label3 = tk.Label(root, text="業種:" + data_how , font=("",20)) label3.place(x=200,y=200) label4 = tk.Label(root, text="住所:" + data_location , font=("",20)) label4.place(x=300,y=300) root.after(1000, modoru) root.mainloop()

気になる質問をクリップする

クリップした質問は、後からいつでもMYページで確認できます。

またクリップした質問に回答があった際、通知やメールを受け取ることができます。

バッドをするには、ログインかつ

こちらの条件を満たす必要があります。

guest

あなたの回答

tips

太字

斜体

打ち消し線

見出し

引用テキストの挿入

コードの挿入

リンクの挿入

リストの挿入

番号リストの挿入

表の挿入

水平線の挿入

プレビュー

まだ回答がついていません

会員登録して回答してみよう

アカウントをお持ちの方は

15分調べてもわからないことは
teratailで質問しよう!

ただいまの回答率
85.48%

質問をまとめることで
思考を整理して素早く解決

テンプレート機能で
簡単に質問をまとめる

質問する

関連した質問