Python Forum
Putting frames on separate lines
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Putting frames on separate lines
#3
Below is my full python program in case you cannot figure it out from the program excerpt.
When you run the program, all the frames appear on the same line.
If anybody can figure out why it does this, it would be appreciated.


from tkinter import filedialog
from tkinter import *
import tkinter.font as font
#import tkinter as tk

def show_entry_fields():
	fname1 = e1.get()
	fname2 = e2.get()
	print("Input File: %s\nOutput File: %s" % (fname1, fname2))

	f1 = open(fname1,"r")
	lines = f1.readlines()
	for x in lines:
		print(x)
	f1.close()



def get_file1():
	file1 =  filedialog.askopenfilename(title = "Select file",filetypes = (("all files","*.*"),("jpeg files","*.jpg"),("python files","*.py")))
	e1.delete(0,'end')
	e1.insert(0,file1)

def get_file2():
	file2 =  filedialog.askopenfilename(title = "Select file",filetypes = (("all files","*.*"),("jpeg files","*.jpg"),("python files","*.py")))
	e2.delete(0,'end')
	e2.insert(0,file2)



mw = Tk()
# 999x999 is size of window, 999+999 is the location of the window
mw.geometry('800x400+400+200')
mw.title("Test Program")

frame1 = Frame(mw).pack(side=TOP,anchor=W,fill=X,expand=YES)
frame2 = Frame(mw).pack(side=TOP,anchor=W,fill=X,expand=YES)
framebot = Frame(mw).pack(side=BOTTOM,anchor=W,fill=X,expand=YES)



w1 = Label(frame1, text="Input File: ",font=("Times",25)).pack(side=LEFT)
e1 = Entry(frame1,width=25,font=("Times",25))
e1.insert(0, "infile.txt")
e1.pack(side=LEFT)

Button(frame1,text='Search',font=("Times",25),command=get_file1).pack(side=LEFT)


w2 = Label(frame2, text="Output File: ",font=("Times",25)).pack(side=LEFT)
e2 = Entry(frame2,width=25,font=("Times",25))
e2.insert(0, "outfile.txt")
e2.pack(side=LEFT)

Button(frame2,text='Search',font=("Times",25),command=get_file2).pack(side=LEFT)


Button(framebot,text='Go',font=("Times",25),command=show_entry_fields).pack()
Button(framebot,text='Exit',font=("Times",25),command=mw.quit).pack()

mw.mainloop()
Reply


Messages In This Thread
Putting frames on separate lines - by kenwatts275 - Dec-05-2019, 02:14 PM
RE: Putting frames on separate lines - by kenwatts275 - Dec-09-2019, 09:53 PM

Possibly Related Threads…
Thread Author Replies Views Last Post
  importing functions from a separate python file in a separate directory Scordomaniac 3 1,426 May-17-2022, 07:49 AM
Last Post: Pedroski55
  List / arrays putting in sentence Kurta 3 2,605 Dec-25-2020, 11:29 AM
Last Post: Larz60+
  Iterate 2 large text files across lines and replace lines in second file medatib531 13 6,046 Aug-10-2020, 11:01 PM
Last Post: medatib531
  Putting a condition Jiwan 3 2,772 Apr-25-2020, 11:28 AM
Last Post: anbu23
  Grabbing comma separed values from SQLite and putting them in a list PythonNPC 8 4,160 Apr-10-2020, 02:39 PM
Last Post: buran
  reading txt file putting in list function Expel 7 3,835 Jul-17-2019, 03:18 PM
Last Post: Expel
  Putting text on images from excel/csv file sam77am 1 2,242 Apr-05-2019, 07:36 AM
Last Post: Larz60+
  Putting an array for each string that is printed to a loop ClaudioSimonetti 1 2,386 Feb-05-2019, 12:52 PM
Last Post: perfringo
  Putting many coordinates number inside codes fyec 1 2,239 Jun-07-2018, 01:09 AM
Last Post: scidam
  How to list objects on separate lines? Intelligent_Agent0 3 4,175 Jan-10-2018, 05:35 AM
Last Post: Intelligent_Agent0

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020