![]() ![]() ![]() Note that I have taken a more object-oriented approach, making the GUI a subclass of Tk (see e.g. ![]() Self.sin_button = tkinter.Button(self.bottom_frame, Self.label2 = tkinter.Label(self.bottom_frame, Self.label1 = tkinter.Label(self.top_frame, text='') Self.prompt_label = tkinter.Label(self.top_frame, A single-button example to get you started: from functools import partial Also, note that your convert functions are trivial and almost identical, so can be factored out entirely by using functools.partial. Changing the text on a label) when the button is pressed. Rather than create and pack a new label for each button press, create a single label in _init_ and change the text (see e.g. Self.label4 = tkinter.Label(self.top_frame, \ Self.label3 = tkinter.Label(self.top_frame, \ Self.label1 = tkinter.Label(self.top_frame, \ Self.label2 = tkinter.Label(self.bottom_frame, \ d_button = tkinter.Button(self.bottom_frame, \ x_button = tkinter.Button(self.bottom_frame, \ Self.sin_button = tkinter.Button(self.bottom_frame, \ Self.prompt_label = tkinter.Label(self.top_frame, \ Is there a way to just swap the output in place of where the previous output was? Thank you in advance and I appreciate any help in steering me toward a solution. Instead after pressing several buttons it displays the translation over and over causing the box area to get larger and larger. I am trying get the output to show up to the right of "English translation" but then be replaced with another output if another button is pressed. When pressed a English equivalent appears in the label of the GUI. The Latin to English translator code below works by displaying three buttons with each having a Latin word on them. I'm new to the Pyhton GUI and have been playing around, for some time now, with the code below. ![]()
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |