如何在文本字段python中显示String变量

时间:2017-07-15 08:07:20

标签: python tkinter

我想在文本字段中显示变量字符串。我正在使用这个功能

    public class Shape{
            public void displayShape(){
               System.out.println("shape displayed");
                      }
    public class Circle extends Shape{
            public void drawCircle(){
                System.out.println("circle drawn");
                      }
    public class Test{
            p.s.v.main(String[] a){
            Circle c=new Circle();
            Shape s=new Shape();
            display(c);
            display(s);
            public void display(Shape myShape){
               myShape.displayShape();//possible for ref variable c and s
               myShape.drawCircle();//not possible for reference var s
               }
             }
         }

现在我希望在此文本字段中打印此file_path

def buttonClick():
    file_path = askopenfilename(filetypes=(("Android Application Files", ".apk"), ("All files", "*.*")))
    print file_path

我该怎么做?

1 个答案:

答案 0 :(得分:0)

我会尝试这个

self.fnameVar = StringVar()
self.fnameEntry = Entry(textvariable=self.fnameVar)
self.fnameVar.set(file_path)