tkinter.messagebox customisation

+1 MSF Jarvis · November 21, 2015
I wanna add a few input boxes into a messagebox in python3.4 but there's  no inbuilt function for this in the tkinter.messagebox class. Any help ???

Post a Reply

Replies

Oldest  Newest  Rating
0 Myron Ortiz · November 22, 2015
I would suggest just writing your own implementation. I grabbed this from another website.


from Tkinter import *

class MyDialog:
def __init__(self, parent):

top = self.top = Toplevel(parent)

Label(top, text="Value").pack()

self.e = Entry(top)
self.e.pack(padx=5)

b = Button(top, text="OK", command=self.ok)
b.pack(pady=5)

def ok(self):

print "value is", self.e.get()

self.top.destroy()


root = Tk()
d = MyDialog(root)

root.wait_window(d.top)
  • 1

Python

103,647 followers
About

This section is all about snakes! Just kidding.

Links
Moderators
Bucky Roberts Administrator