Skip to content

Save UI as separate file #489

Answered by ghost
LalFX asked this question in Q&A
Sep 18, 2023 · 2 comments · 3 replies
Discussion options

You must be logged in to vote

One way I have found to do this is to create class with all the form layout, and implement get and set methods to load the form and retrieve the data. Something like this:

from typing import Any

from ttkbootstrap import Entry, Label, StringVar, Toplevel  # type: ignore

class MY_UI(Toplevel):
    def __init__(self, *args: Any, **kwargs: Any) -> None:
        super().__init__(*args, themename="darkly", **kwargs)  # type: ignore

        self.label1: Label = Label(self, text="Entry one")
        self.label1.grid(row=0, column=0, padx=10, pady=10)

        self.entry1_value: StringVar = StringVar()
        self.entry1: Entry = Entry(self, textvariable=self.entry1_value)
        self.entry1.…

Replies: 2 comments 3 replies

Comment options

You must be logged in to vote
1 reply
@LalFX
Comment options

Answer selected by LalFX
Comment options

You must be logged in to vote
2 replies
@LalFX
Comment options

@rdbende
Comment options

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants