I made a program to look up words on the window (previous development)

(Amateur writes like that.) Hi, I ’m Nagamasa Yamada. I tried the last one on Window It ’s a program with a great feeling of force. Please ** look with warm eyes **

I will write with the ** premise I know ** of all Last time ↓ https://qiita.com/yamadanagamasa/items/3752e5849ff3b6344348

reference https://qiita.com/Joachim_Sgr/items/d16951ed71eb7da3cb2d The one I used VS code

program

qiita.rb


#Module import
import os, tkinter, tkinter.filedialog, tkinter.messagebox
from bs4 import BeautifulSoup
import urllib
import urllib.parse
import requests

def func():
    rrr= []
    global value
    print("in the function =",EditBox1.get())
    value = EditBox1.get()
    m = value
    print(m)
    m = urllib.parse.quote(value)
    #sennbonn
    url =f'https://dictionary.goo.ne.jp/srch/all/{m}/m0u/'
    headers = {
            "User-Agent": "Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:47.0) Gecko/20100101 Firefox/47.0",
            }
    #re = urllib.request.Request(url, headers=headers)
    print(url)
    re = requests.get(url)
    #html = urllib.request.urlopen(re)
    soup = BeautifulSoup(re.text, 'html.parser')
    a = soup.select('#NR-main-in > section:nth-child(2) > div > div.example_sentence > ul > li:nth-child(1) > a > p.text')
    print(a, "a")
    for x in a:
        rrr.append(x.text)
    g = "".join(rrr)
    print(g)
    answer = tkinter.Label(text=g,bg="white")
    answer.place(x=20,y=100)

#Window
root = tkinter.Tk()
root.title(u"window dictonary")
root.geometry("400x300")

#Data number input
Static1 = tkinter.Label(text=u'Words you want to look up')
Static1.place(x=5,y=5)
EditBox1 = tkinter.Entry(width=10)
EditBox1.place(x=100, y=5)

b = tkinter.Button(text='search', command=func)
b.pack()

root.mainloop()


print("value=",value) #Confirm that the data has been stored

There are various prints, but these are not necessary. Mostly for confirmation. I have a text box or Window in tkinter I forcibly put the previous one in func ().

(the end) It may be confusing, but thank you for reading.

Recommended Posts

I made a program to look up words on the window (previous development)
I made a program to solve (hint) Saizeriya's spot the difference
I made a kitchen timer to be displayed on the status bar!
I made a program to check the size of a file in Python
I made a tool to automatically back up the metadata of the Salesforce organization
I made a script to record the active window using win32gui of Python
I made a function to check the model of DCGAN
I made a VGG16 model using TensorFlow (on the way)
I made a program to collect images in tweets that I liked on twitter with Python
I made a program that solves the spot the difference in seconds
I tried to register a station on the IoT platform "Rimotte"
I made a command to display a colorful calendar in the terminal
I made a program that automatically calculates the zodiac with tkinter
[Python] I tried to make a simple program that works on the command line using argparse.
I made a POST script to create an issue on Github and register it in the Project
I made a payroll program in Python!
I made a program to notify you by LINE when switches arrive
I made a script to display emoji
I made a program to input what I ate and display calories and sugar
I made a library konoha that switches the tokenizer to a nice feeling
I made a function to see the movement of a two-dimensional array (Python)
I made a tool to estimate the execution time of cron (+ PyPI debut)
[LINE Messaging API] I want to send a message from the program to everyone's LINE
I made an appdo command to execute a command in the context of the app
I made a tool to generate Markdown from the exported Scrapbox JSON file
Python program is slow! I want to speed up! In such a case ...
I want to create a window in Python
I made a tool to compile Hy natively
How to set up a local development server
Set up a Python development environment on Marvericks
I made a tool to get new articles
I made a Caesar cryptographic program in Python.
I did a little research on the class
It's been a year since I was self-taught and moved to the web application development department, so I look back
[Python] I made an app to practice the subtle voice distinction of English words.
I made a program to convert images into ASCII art with Python and OpenCV
It was a life I wanted to OCR on AWS Lambda to locate the characters.
I want to take a screenshot of the site on Docker using any font
I made a small donation to the non-profit organization "Open Source Robot Foundation" OSRF
I made a command to wait for Django to start until the DB is ready
How to test the current time with Go (I made a very thin library)
Think about how to program Python on the iPad
I made a prime number generation program in Python
I made a window for Log output with Tkinter
I made a script to put a snippet in README.md
I made a Python module to translate comment outs
I made a program in Python that changes the 1-minute data of FX to an arbitrary time frame (1 hour frame, etc.)
I want to find a popular package on PyPi
I made a code to convert illustration2vec to keras model
I made a Python3 environment on Ubuntu with direnv.
I want to easily build a model-based development environment
I tried to notify the honeypot report on LINE
I made a tool to get the answer links of OpenAI Gym all at once
I made a class to get the analysis result by MeCab in ndarray with python
I made a function to crop the image of python openCV, so please use it.
I made a tool to automatically generate a simple ER diagram from the CREATE TABLE statement
What I did to speed up the string search task
I scraped the Organization member team and made a ranking
I made a package to filter time series with python
I made a box to rest before Pepper gets tired
I made a command to generate a table comment in Django