[我正在python tkinter中创建发票模板,我无法在此处更改变量的字体大小。请在此[关闭]中帮助我

问题描述 投票:-4回答:1

我需要更改变量的字体大小并使其变为粗体

    # templates for the bill
    name = self.customername_e.get()
    mobile = self.customermobile_e.get()
    caddress = self.customeraddress_e.get()
    cgst= self.customergstin_e.get()

    gstin = "GSTIN:"
    invoice = "\t\t Invoice"
    dt = "\t\t\t\t\t" + str(date)
    num1 = "\nMob-1111111111"
    num2 = "\n    2222222222"
    company = "\n\n\t\t\t\t    SHOWROOM\n"
    address = "\tMain Road, PATNA\n"
    email = "\t\t\tEmail:[email protected] \n"
python tkinter invoice
1个回答
-2
投票

您是否正在尝试将字符串输出到终端或Tkinter窗口?如果您尝试仅打印到终端,除非您完全了解IDE /终端,否则将无法实现更改字体大小或格式。

如果要输出到Tkinter窗口,请将每个字符串放入标签中,然后将其呈现到窗口中,如下所示:

import tkinter
window = Tk()
fontSize = #required size

invoice = Label(Tk(), text=invoiceText, font=("font family",fontSize,"bold")).pack()
##repeat for each string you wish to render
window.mainloop()
© www.soinside.com 2019 - 2024. All rights reserved.