Python 3.4.1, Tkinter 8.6.3, Event within class throwing 'Name not defined' error when looking for class button -


After clicking on a button I'm trying to set the 'normal' button, but whatever Due to the incident, the button does not seem to find, I give the reference and the error of a name: the name 'rawButton' is not defined ' error I self I tried to prepare the button with but then I get a not self-defined error I have seen everything and I can not understand why it works for my life Not doing ... Thanks for any help you can give.

Related code below:

  imported import from importing imported as tk * class main class: root = vaccine. Vaccine () root. ('Main window') def call_bgFrame (auto): self.background = bgFrame () rawButton.config (state = 'normal') label = ['calibration', 'background', 'raw data', 'bin' 'Plot'] calibbutton = tk.button (root, text = labels [0], width = 20, height = 5) bg button * vaccine. Button (root, text = labels [1], width = 20, height = 5) Katchy button = vaccine. Button (root, text = labels [2], width = 20, height = 5, position = 'disabled') Binbutton = Vaccines Button (root, text = labels [3], width = 20, height = 5, position = 'disabled') plotButton = Tk.Button (text = labels [3], width = 40, height = 5, status = 'disabled Bb.button.grid (line = 0, column = 1), RawButton.grid (line = 0, column = 2) binButton.grid (line = 1, column = 0) calibbutton.grid (line = 0, column = 0) Plotbutton.grid (line = 1, column = 1, column = 2) bgButton.bind ('& lt; button-1'; PU's n_bgFrame) tk.mainloop ()  

Note: that is one of the functions to import from bgFrame () function imaging and return an array Use is made (Numpy).

Your coding style is very confusing and can be solved by pasting it on another common style of coding : Move the code to __init __ and save the reference as widgets in the example variable. Import imaging from ticker to Tucker * Class Mainclass: Def __int_ (self): root = vaccine. Vaccine () root. The title ('main window') label = ['calibration', 'background', 'raw data', 'bin', 'plot'] self.calibButton = tk.button (root, text = label [0], width = 20, height = 5) self.bgButton = tk.Button (root, text = label [1], width = 20, height = 5) self Strawberry = Vaccines Button (root, text = labels [2], width = 20, height = 5, state = 'disabled') self BinButton = tk.Button (root, text = label [3], width = 20, height = 5, state = 'disabled') self.plotButton = tk.Button (text = label [3], width = 40, height = 5, state = 'disabled') self.calibButton.grid (line = 0, column = 0) self.bgButton.grid (line = 0, column = 1) self.rawButton.grid (line = 0, column = 2) Self.binButton.grid (line = 1, column = 0) self.plotButton.grid (line = 1, column = 1, columnpan = 2) self.bgButton.configure (command = self.call_bgFrame) root.mainloop () call_bgFrame (Self) def: self.background = bgFrame () self.rawButton.config (state = 'normal') application = MainClass ()

There are just a few other things The programmed I change it, but I try to keep it as original as possible to your address.


Comments

Popular posts from this blog

python - Overriding the save method in Django ModelForm -

html - CSS autoheight, but fit content to height of div -

qt - How to prevent QAudioInput from automatically boosting the master volume to 100%? -