So I moved from printing my results to displaying them via a tkinter label.
ttk.Label(root, text = ('Erlaubte Fehlergrenze zwischen', hin1,' und ', hin2,' = ',fehlergrenze,' Wir haben: ', fehler)).pack()
Now I have the problem that I get unwanted brackets {} seemingly coming from ''.
Example for a current output: {Erlaubte Fehlergrenze zwischen} 0100042 { und } 0100047 { = } 2.83 { Wir haben: } 2.78
I am thinking the problem here is that I am trying to display a tuple instead of a string, so I decided to convert it into a string and display it which doesnt seem too smart either.
Maybe there is an easier/better option to just avoid those brackets?
Thanks in advance.
Example for a wanted output: Erlaubte Fehlergrenze zwischen 0100042 und 0100047 = 2.83 Wir haben: 2.78
CodePudding user response:
Does this help? Using f-strings in Python 3.6 and later.
Code:
from tkinter import ttk
import tkinter as tk
root = tk.Tk()
hin1 = '0100042'
hin2 = '0100047'
fehlergrenze = 2.83
fehler = 2.47
ttk.Label(root, text = f'Erlaubte Fehlergrenze zwischen {hin1 } und { hin2} = { fehlergrenze } Wir haben:{fehler}').pack()
root.mainloop()
Output image: