[英]It's my first time trying tkinter and I can't get over this error. Can someone tell me what's wrong with it and suggest a fix?
這是我第一次嘗試 tkinter,我無法克服這個錯誤。 有人可以告訴我它有什么問題並建議修復嗎?
我得到 TypeError: repip() 只需要 1 個參數(0 給定)錯誤。
import Tkinter as tk
from Tkinter import *
import ttk
import tkFileDialog as filedialog
import os
import requests
from multiprocessing import Pool
from multiprocessing.dummy import Pool as ThreadPool
from re import findall as reg
import shutil
main_window = tk.Tk()
main_window.title('sample 1')
main_window.resizable(False, False)
main_window.geometry("390x400")
def open_file(file):
file = filedialog.askopenfile(mode='r', filetypes=[('text files', '*.txt')])
file = open(file, 'r').read().splitlines()
Thread = 50
pool = ThreadPool(int(Thread))
pool.map(repip, file)
pool.close()
pool.join()
if file:
filepath = os.path.abspath(file.name)
entry1.insert(END, filepath)
def repip(file):
try:
grab = requests.get('https://tools.webservertalk.com/?tool=reverseip&host='+file).content
if 'Domain / IP:' in grab:
regx = reg('<td class="text-left">(.*?)<', grab)
for ckk in regx:
mek = ckk.replace("Domain","")
listbox.insert("{}[Grabbed] {}".format(Fore.YELLOW, str(mek)))
open('grabbed.txt', 'a').write('http://'+mek+'\n')
else:
print "{}[Operation timed out] {}".format(Fore.RED, str(url))
except:
pass
label = Label(main_window, text="Select domain list")
label.grid(row=0, sticky=W, pady=3, padx=3)
entry1 = tk.Entry(main_window, width=50)
entry1.grid(row=1, sticky=W, pady=3, padx=3)
ttk.Button(main_window, text="Browse", command=open_file).grid(row=1, column=1, sticky=W, pady=2)
ttk.Button(main_window, text="Start", command=repip).grid(row=2, column=1, sticky=W, pady=2)
listbox = Listbox(main_window, width=50, height=20)
listbox.place(x=2, y=60)
scrollbar = Scrollbar(main_window, orient="vertical", command=listbox.yview)
scrollbar.place(x=290, y=60, height=323)
listbox.config(yscrollcommand=scrollbar.set)
tk.mainloop()
pool.map
的第二個參數是一個可迭代對象,就像一個列表。 用方括號環繞file
,它應該可以工作:
pool.map(repip, [file])
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.