im having some trouble to create new GUI using python Tkinter module.
from Tkinter import * import Tkinter as tk import tkMessageBox import tkFont class GUIFramework(Frame): """This is the GUI""" def __init__(self,master=None): Frame.__init__(self,master) self.pack(padx=100,pady=100) self.master.title("Lab Management Hosts") self.costumFont = tkFont.Font( family = "Helvetica", size=30, weight="bold") label = tk.Label(master, text = "Lab Mangement Application", font = self.costumFont) label.pack(padx=0, pady=0) #self.app_name = Label(self,text="Lab Management", font= ("Helvetica",20)) self.CreateWidgets() def CreateWidgets(self): self.check_hosts = Button(self, text="Check Ping to hosts", font = ("Helvetica",10)) self.check_hosts.pack(padx=0,pady=0) if __name__ == "__main__": guiFrame = GUIFramework() guiFrame.mainloop()
im new to python Tkinter and all i've used in this code is from google.
the main problem is that im not able to move the text where i want.
the text is always on the center of the screen.
i've tried to use Label, tried to use other options as anchor,side, etc.
nothing is worked for me.
im not quite sure what is the difference between the locations parameters in pack() or grid() but i've tried both of them and still cant do that.
in this code, currently im getting
first line "first_command" on the center of the row
and under it another line of the "application name" once again on center.
how do i choose the location of the texts, buttons, pictures im using?
why does padx,pady (i'ev also tried row,column,ipadx,ipady) doesnt work?
the lable text defined as (0,0), why he is located in the center of the screen?
any help will be appriciated.