繁体   English   中英

这是我第一次尝试 tkinter,我无法克服这个错误。 有人可以告诉我它有什么问题并建议修复吗?

[英]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.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM