顯示具有 Python 標籤的文章。 顯示所有文章
顯示具有 Python 標籤的文章。 顯示所有文章

2019年5月14日 星期二

[Python] [pyinstaller] release to the exe file

Step 1: Open "Anaconda Prompt" for the installer command. Of course, you must install the relative application in your PC first.
Step 2:
type the install command:
ex:
pyinstaller -F F:\WEI_LUN\code_project\python\project\ptyhon_project\main_crawler.py

------
That is all.


Note:
The pyinstaller error from the NoteBook:
python用pyinstaller生成exe时报错 TypeError: an integer is required (got type bytes)
https://blog.csdn.net/chen_soldier/article/details/102667201

2019年2月20日 星期三

install pyautogui

Windows can't install pyautogui 0.9.41:
https://github.com/asweigart/pyautogui/issues/292

Solution: Please to install pyautogui 0.9.39 by using the following command line

pip install pyautogui===0.9.39

ref: https://github.com/asweigart/pyautogui/issues/292

2016年12月29日 星期四

send gmail

step 1:please read the policy of gmail http://stackoverflow.com/questions/20337040/gmail-smtp-debug-error-please-log-in-via-your-web-browser step 2: ex: http://stackoverflow.com/questions/17332384/python-3-send-email-smtp-gmail-error-smtpexception ex: no chinese in code http://johnisacoolboy.pixnet.net/blog/post/148222978-python-email%E5%AF%84%E4%BF%A1%E6%A8%A1%E7%B5%84%E7%9A%84%E4%BD%BF%E7%94%A8%E6%96%B9%E5%BC%8F

2016年11月25日 星期五

[Label] hover effort by using event

def callback_text(event):
    txt_keyword = event.widget.cget("text")
    idx_start = txt_keyword.find("https")
    idx_end = len(txt_keyword) - 1
    url = txt_keyword[idx_start : idx_end]
    webbrowser.open_new(url)
    event.widget.config(text = "X |" + txt_keyword)


def changeBGLeave(event):
    event.widget.config(fg="red")

def changeBGEnter(event):
    event.widget.config(fg="blue")




            lbl = Label(root,  text = txt_content , fg="blue", cursor="hand2")          
            lbl.pack(anchor="w")
            lbl.bind("<Button-1>", callback_text)
            lbl.bind("<Enter>",changeBGLeave)
            lbl.bind("<Leave>",changeBGEnter)


http://stackoverflow.com/questions/4299145/getting-the-widget-that-triggered-an-event

2016年11月20日 星期日

2016年11月19日 星期六

2016年11月18日 星期五

[Crawler] Beginning: Trying urllib.request

method 1: open a File and save it in your current python Folder.
method 2:

type each command

import urllib.request

x = urllib.request.urlopen("http://www.google.com/")

print(x.read())

https://www.youtube.com/watch?v=5GzVNi0oTxQ


2.type line by line as below code
from urllib.request import urlopen
html = urlopen("http://www.google.com/")
print(html)
print(html.read())



http://stackoverflow.com/questions/22676/how-do-i-download-a-file-over-http-using-python

reference:
[book] A Brain-Friendly Guide, Paul Barry && David Griffths