简体   繁体   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?

It's my first time trying tkinter and I can't get over this error.这是我第一次尝试 tkinter,我无法克服这个错误。 Can someone tell me what's wrong with it and suggest a fix?有人可以告诉我它有什么问题并建议修复吗?

I get TypeError: repip() takes exactly 1 argument (0 given) error.我得到 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()

The second argument for pool.map is an iterable, like a list. pool.map的第二个参数是一个可迭代对象,就像一个列表。 Wrap around the file in square brackets and it should work:用方括号环绕file ,它应该可以工作:

pool.map(repip, [file])

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 有人可以告诉我我的 animation 代码有什么问题吗? - Can someone tell me what's wrong with my animation code? 有人能告诉我出了什么问题,当我运行它时,浏览器说“无法访问此站点” - Can someone tell me what's wrong, when I run it the browsers says "This site can’t be reached" 谁能告诉我这里的代码有什么问题? - Can anyone tell me what's wrong with my code here? 谁能告诉我我的功能出了什么问题? - Can anyone tell me what's wrong with my function? 这个错误试图告诉我什么,我该如何解决? - What is this error trying to tell me and how can I fix it? 有人能告诉我我的代码有什么问题吗 - Can someone tell me what is wrong with my code 这是什么“_tkinter.TclError: bad option”。 谁能告诉我我做错了什么并告诉我如何解决这个问题? - What is this “_tkinter.TclError: bad option”. can anybody tell me what I've done wrong and tell me how to fix this? 有人可以告诉我我做错了什么[暂停] - Can someone tell me what I'm doing wrong [on hold] 有人可以告诉我我做错了什么吗? - Can someone tell me what am I doing wrong? 我的代码引发了递归错误。 有人可以向我解释我的递归基础代码有什么问题吗? - My code throws recursive error. Can somebody explain to me what's wrong with my base code in recursion?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM