reklama

Python Tkinter vracia nulovu hodnotu

Python Tkinter vracia nulovu hodnotu
« kdy: 02. 07. 2019, 11:04:57 »
Dobry den.
Pouzivam Python 3 + tkinter. Mam par okien ma slidery a funguje to bez problemu. Jedno vsak vracia stale 0.0 aj ked zadam akukolvek hodnotu. Presiel som to 50x porovnal ale neviem prist na to kde som spravil chybu.

Kód: [Vybrat]
def george_settings(self):
       
        self.georgeset = tk.Tk()  # initialize georgeset window
        self.georgeset.title("George AI Settings")  # set window title
        # self.destructor function gets fired when the window is closed
        self.georgeset.protocol('WM_DELETE_WINDOW', self.destructor)
       
        self.confidence_val = confidence_level
        self.confiden-ce_slider = tk.DoubleVar()
        self.detect_resolution_slider = tk.DoubleVar()
        self.detect_resolution_slider_val = detect_resolution

        georgeset = self.georgeset
        tk.label = tk.Label(georgeset, text="Object Confidence").grid(row=0, column=0)
        scaleConfidence = tk.Scale(georgeset, orient=tk.HORIZONTAL, from_=0, to=100, resolution=0.05, variable=self.confidence_slider)
        scaleConfidence.set(self.confidence_val)
        scaleConfidence.grid(row=1, column=0)

        scaledetect_resolution = tk.Scale(georgeset, orient=tk.HORIZONTAL, from_=200, to=1000, resolution=1.00, variable=self.detect_resolution_slider)
        scaledetect_resolution.set(self.detect_resolution_slider_val)
        scaledetect_resolution.grid(row=2, column=0)

        #Button
        tk.Button(georgeset, text="Set Value", command=self.set_george_setting).grid(row=7, column=0)
         
        tk.Button(georgeset, text="Close", command=georgeset.destroy).grid(row=7, column=1)

    def set_george_setting(self):
          confidences = self.confidence_slider.get()
          detect_resolution_slider = self.detect_resolution_slider.get()
          print (confidences)
          print (detect_resolution_slider)
          confidence_level = confidences

reklama


Re:Python Tkinter vracia nulovu hodnotu
« Odpověď #1 kdy: 02. 07. 2019, 12:11:52 »
tak nie. Zistujem ze to nefunguje po tom co som to prepisal s pack na grid. Neviem sice este preco ale chyba bude niekde tam.

 

reklama