AttributeError: 'NoneType' object has no attribute 'bind'
enter image description here hi. i try to solve such a problem so that it's give me AttributeError can you help me
See also questions close to this topic
Python script communicate with server
I am trying to write a python script that can communicate with a server running on port 9999. To be able to set ut the communication with the server, I have to provide a secret code for the server.
How do I set up communication with the server using python? And where in the set-up process should I provide the secret code?
I'm also supposed to solve different "puzzles" on the server, how do I find the information on the server when the communication is set up?
Hope anyone can help!!
read file block by block in python
I have file that has this format
MACRO L20_FDPQ_TV1T8_1 FIXEDMASK ; CLASS CORE ; ... ... END L20_FDPQ_TV1T8_1 MACRO INV_20 ... ... END INV_20
I want to read the file as blocks such that each MACRO to end of its name form a block in python. how this can be done in an efficient way?
what is the difference in these two isinstances() definitions?
Is there any difference apart from the speed? I can see 2 is faster.
How to crawl 3 websites with beautifulsoup and add its items in single csv
I have and project to crawl 3 websites with almost similar information's from each product items.
I have to use BeautifulSoup and Pandas.
My question is how to crawl three websites in single beautifulSoup file, and add them all together in single project?
I have to add and export all items from websites in single csv file or jsnon file, because client have compare prices and items.
Any help of guide or suggestion will be appreciate. Thanks a lot!
Python 3 equivalent of Python 2 str.decode('hex')
I'm trying to convert IEEE 754 floats in hex to standard python floats.
The following works in Python 2.x :
foo ='4074145c00000005' conv_pound = struct.unpack('!d', foo.decode('hex')) print(conv_pound)
and produces the following output (which is indeed the number that I want):
However, python 3 does not have a str.decode method and I'm struggling to find how to do this. Any tips ?
Image is not showing in tkinter
I am making a GUI application by tkinter in python.There is a help menu in menu bar which opens new window on clicking.There are 3 images on this window but they are not showing and there is also scroll bar on this window.
GUI application using tkinter python.
from tkinter import * class Window: def __init__(self, master): menu = Menu(master) master.config(menu=menu) file = Menu(menu) menu.add_command(label="Help", command=self.show_help) def show_help(self): global new_help new_help = Toplevel(root) new_help.title("Help") new_help.geometry("650x550+490+100") new_help.resizable(FALSE, FALSE) global hp_canvas, hp_frame_can hp_canvas = Canvas(new_help, bg="#FFF0F5", height=540, width=605) hp_canvas.pack(side=LEFT, padx=8) hp_scroll = Scrollbar(new_help, command=hp_canvas.yview) hp_scroll.pack(side=LEFT, fill=Y) hp_canvas.configure(yscrollcommand=hp_scroll.set) hp_canvas.bind('<Configure>', self.hp_on_conf) hp_frame_can = Frame(hp_canvas) hp_canvas.create_window((5, 5), window=hp_frame_can, anchor='nw') global canvas1, canvas2, canvas3 step_1 = Label(hp_frame_can, text="Step 1 ", height=2, width=90, bg="#f0fff0", anchor=W) step_1.pack(side=TOP, pady=5) canvas1 = Canvas(hp_frame_can, width=460, height=260, bg='blue') canvas1.pack() gif1 = PhotoImage(file='E:/deepak/image/img1.png') canvas1.create_image(0, 0, image=gif1, anchor=NW) step_2 = Label(hp_frame_can, text="Step 2 ", height=2, width=90, bg="#f0fff0", anchor=W) step_2.pack(side=TOP, pady=5) canvas2 = Canvas(hp_frame_can, width=455, height=255, bg='blue') canvas2.pack() gif2 = PhotoImage(file='E:/deepak/image/img2.png') canvas2.create_image(0, 0, image=gif2, anchor=NW) step_3 = Label(hp_frame_can,text="Step 3 ", height=2, width=90, bg="#f0fff0", anchor=W) step_3.pack(side=TOP, pady=5) canvas3 = Canvas(hp_frame_can, width=451, height=254, bg='blue') canvas3.pack() gif3 = PhotoImage(file='E:/deepak/image/img3.png') canvas3.create_image(0, 0, image=gif3, anchor=NW) def hp_on_conf(self, event): global hp_canvas hp_canvas.configure(scrollregion=hp_canvas.bbox('all')) if __name__ == '__main__': root = Tk() root.config(background='#C0C0C0') root.title("Demo") root.geometry("1000x650+280+70") root.resizable(FALSE, FALSE) app = Window(root) root.mainloop()
how to install tkinter in red hat enterprise 7.5
tkinter is not pre installed. I have checked that.I have tried to install tkinter using
yum install tkinter
after this i am getting an error
Loaded plugins: langpacks, product-id, search-disabled-repos, subscription-manager This system is not registered with an entitlement server. You can use subscription-manager to register. Repository 'a' is missing name in configuration, using id Repository 'c' is missing name in configuration, using id Repository 'kgdi' is missing name in configuration, using id Repository 'e' is missing name in configuration, using id Existing lock /var/run/yum.pid: another copy is running as pid 3212. Another app is currently holding the yum lock; waiting for it to exit... The other application is: PackageKit Memory : 31 M RSS (405 MB VSZ) Started: Mon Nov 19 18:41:56 2018 - 04:47 ago State : Sleeping, pid: 3212
i have also tried using pip install
Collecting tkinter Could not find a version that satisfies the requirement tkinter (from versions: ) No matching distribution found for tkinter
Python 3 - KeyboardInterrupt in background thread not detected by main thread until user hovers over GUI window
I've written a Python 3 TkInter-based GUI application that launches a worker thread in the background. After the worker thread has finished, it waits two seconds (this is to avoid a possible race condition), and then sends a KeyboardInterrupt to tell the main thread it can close down.
Expected behaviour: running the program launches a GUI window, prints some text to the console after which the program closes down automatically.
Actual behaviour: instead of closing automatically, it only does so after the user either hovers the mouse over the GUI window area, or presses a key on the keyboard! Apart from that the program runs without reporting any errors.
Anyone have any idea why this is happening, and how to fix this? I already tried to wrap the KeyboardInterrupt into a separate function and then call that through a timer object, but this results in the same behaviour.
I've been able to reproduce this issue on 2 different Linux machines that run Python 3.5.2. and 3.6.6 respectively.
#! /usr/bin/env python3 import os import threading import _thread as thread import time import tkinter as tk import tkinter.scrolledtext as ScrolledText class myGUI(tk.Frame): # This class defines the graphical user interface def __init__(self, parent, *args, **kwargs): tk.Frame.__init__(self, parent, *args, **kwargs) self.root = parent self.build_gui() def build_gui(self): # Build GUI self.root.title('TEST') self.root.option_add('*tearOff', 'FALSE') self.grid(column=0, row=0, sticky='ew') self.grid_columnconfigure(0, weight=1, uniform='a') # Add text widget to display logging info st = ScrolledText.ScrolledText(self, state='disabled') st.configure(font='TkFixedFont') st.grid(column=0, row=1, sticky='w', columnspan=4) def worker(): """Skeleton worker function, runs in separate thread (see below)""" # Print some text to console print("Working!") # Wait 2 seconds to avoid race condition time.sleep(2) # This triggers a KeyboardInterrupt in the main thread thread.interrupt_main() def main(): try: root = tk.Tk() myGUI(root) t1 = threading.Thread(target=worker, args=) t1.start() root.mainloop() t1.join() except KeyboardInterrupt: # Close program if subthread issues KeyboardInterrupt os._exit(0) main()
(Github Gist link to the above script here)