Python Forum
[Tkinter] Anyone know what happened to my button?
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
[Tkinter] Anyone know what happened to my button?
#10
I missed that Tongue
it should be
for row_index, text in (
            (1, 'Fecha de medición : '), (2, 'Hora de medición : '),
            (4, 'Voltage de Panel 1 : '), (5, 'Voltage de Panel 2 : '),
            (6, 'Voltage de Panel 3 : '), (7, 'Promedio : '),
                (9, 'Panel con Menor Voltaje : ')):
            label = tk.Label(self, text=text)

it doesn't actually need two for loop in FormFrame, it can be changed to
class FormFrame(tk.Frame):
    def __init__(self, *args, **kwargs) -> None:
        kwargs['width'] = '1200'
        kwargs['height'] = '600'
        super().__init__(*args, **kwargs)
        self.config(bg="#98A7AC")
        self.str_variables = []

        label1 = tk.Label(
            self, text="Sistema de monitoreo de Paneles del SESLab", font=18)
        label1.grid(row=0, column=0, padx=5, pady=5, columnspan=2)

        for row_index, text in (
            (1, 'Fecha de medición : '), (2, 'Hora de medición : '),
            (4, 'Voltage de Panel 1 : '), (5, 'Voltage de Panel 2 : '),
            (6, 'Voltage de Panel 3 : '), (7, 'Promedio : '),
                (9, 'Panel con Menor Voltaje : ')):
            label = tk.Label(self, text=text)
            label.grid(row=row_index, column=0, padx=2, pady=5)
            
            str_variable = tk.StringVar()
            entry = tk.Entry(self, textvariable=str_variable)
            entry.grid(row=row_index, column=1, padx=1, pady=5)
            entry.config(fg="black", justify="center", state='readonly')
            self.str_variables.append(str_variable)

    @tk_after
    def set_str_variables(self, results):
        for str_variable, result in zip(self.str_variables, results):
            str_variable.set(result)
IgnacioMora23 likes this post
Reply


Messages In This Thread
RE: Anyone know what happened to my button? - by Yoriz - May-29-2021, 08:26 PM

Possibly Related Threads…
Thread Author Replies Views Last Post
  [PySimpleGui] How to alter mouse click button of a standard submit button? skyerosebud 3 5,029 Jul-21-2019, 06:02 PM
Last Post: FullOfHelp

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020