Git Product home page Git Product logo

Comments (4)

TomSchimansky avatar TomSchimansky commented on May 16, 2024 1

You need the right indentation in the class! if the method indicator_settings should be a function of the CTk class, the it should definitely look like def indicator_settings(self, slider_value):. If its just a temporary function inside of the init method it should look like def indicator_settings(slider_value):! But this is not a customtkinter related problem, so please refer to other websites like StackOverflow or python tutorials on classes and functions.

from customtkinter.

TomSchimansky avatar TomSchimansky commented on May 16, 2024

Hi, is it correct that your indicator_settings method is indented? If yes this is wrong, it should at the same indentation level as the other class functions. The second problem is that you assigned the indicator_settings function as command for the sliders, but a slider command callback function gets passed the value of the specific slider it gets called from, so your'e slider callback function should look like this: def indicator_settings(self, slider_value). And if you then get the value from the lsiders directkly with .get() inside the callback you don't need to use the value, but it needs to be in the function header as an argument.

But what I would do is to create a different callback function for every slider, or use tkinter variables.

from customtkinter.

glr-87278mau avatar glr-87278mau commented on May 16, 2024

Hi, is it correct that your indicator_settings method is indented? If yes this is wrong, it should at the same indentation level as the other class functions. The second problem is that you assigned the indicator_settings function as command for the sliders, but a slider command callback function gets passed the value of the specific slider it gets called from, so your'e slider callback function should look like this: def indicator_settings(self, slider_value). And if you then get the value from the lsiders directkly with .get() inside the callback you don't need to use the value, but it needs to be in the function header as an argument.

But what I would do is to create a different callback function for every slider, or use tkinter variables.

Hi, thanks for your reply
Im now only using 1 function per slider
def indicator_settings_1(self, slider_value): val_supertrend_atr = self.slider_atr.get()
self.slider_atr = customtkinter.CTkSlider(master=self.frame_right, from_=1, to=32, number_of_steps=31, command=indicator_settings, )
however this returns the error TypeError: App.__init__.<locals>.indicator_settings() missing 1 required positional argument: 'slider_value' PS C:\Users\user\pyto\projects\website_bots\front>

When trying to make the same function without the argument ( def indicator_settings_1(self,): val_supertrend_atr = self.slider_atr.get())
it returns the same error as before ( val_supertrend_atr = self.slider_atr.get() AttributeError: 'float' object has no attribute 'slider_atr')

from customtkinter.

glr-87278mau avatar glr-87278mau commented on May 16, 2024
        def indicator_settings(self):
            print(self)

This worked!

from customtkinter.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.