Python Forum
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Need help in tkinder
#1
I am new to using tkinder
I want to adjust the radio button with 4 button in 1 row.
I am not sure how to do it

Also
I want to put the " hell0" button by the bottom
please advise.Thanks







#http://pythoncentral.io/introduction-to-pythons-tkinter/
#https://www.tutorialspoint.com/python/tk_radiobutton.htm
import sys
import os
from Tkinter import *
import tkMessageBox

def helloCallBack():
index="?selectedHdbTownIds="+str(town_var.get())
print "Town is", str(town_var.get())
print "Size is", str(size_var.get())
print "Psf is", str(psf_var.get())


UU= "start python helo.py " + index
os.system(UU)
#os.system("start python hello.py")

def sel(): #this is for the Town
selection = "You selected the option " + str(town_var.get())
label.config(text = selection)

root = Tk()

#https://www.python-course.eu/tkinter_radiobuttons.php

town_var = IntVar()
town_var.set("Hougang") # initial value

label = Label(root,text="""Choose a programming language:""",
justify = LEFT,padx = 10)
label.pack(fill=X)

periods = [
("Hougang", 12),
("uinal", 1),
("tun", 2),
("katun", 3),
("baktun", 4),
("Hougang", 5),
("AMK", 6),
("Wlkd", 7),
("katun", 8),
("baktun", 9),
("Hougang", 10),
("uinal", 11),
("tun", 2),
("katun", 3),
("baktun", 4),
]

for t, m in periods :
town_option = Radiobutton(root, text=t, variable=town_var, value=m, command=sel)
#town_option.pack(anchor=W)
town_option.pack(anchor=W)

#drop down list
#http://effbot.org/tkinterbook/optionmenu.htm

##########################
label = Label(root,text="""Size:""")
label.pack(padx=5, pady=10, side=LEFT)

size_var = StringVar(root)
size_var.set("No Min") # initial value

size_option = OptionMenu(root, size_var, "No Min", "200", "400", "600", "800")
size_option.pack(padx=5, pady=10, side=LEFT)


###########################
#http://effbot.org/tkinterbook/pack.htm#patterns

##########################
label = Label(root,text="""PSF:""")
label.pack(padx=5, pady=10, side=LEFT)
##

psf_var = StringVar(root)
psf_var.set("No Min") # initial value

psf_option = OptionMenu(root, psf_var, "No Min", "200", "400", "600", "800")
psf_option.pack(padx=5, pady=10, side=LEFT)


###########################


Button_option=Button(root,text="hello",command= helloCallBack)
Button_option.place(x=260, y=260)

root.mainloop()
Reply


Forum Jump:

User Panel Messages

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