Questions tagged [tkmessagebox]

The tkMessageBox is a tkinter module that is used to display message boxes in your applications. This module provides a number of functions that you can use to display an appropriate message.

The tkMessageBox module is used to display message boxes in your applications. This module provides a number of functions that you can use to display an appropriate message.

Some of these functions are showinfo, showwarning, showerror, askquestion, askokcancel, askyesno and askretryignore.

Syntax:

Here is the simple syntax to create this widget:

tkMessageBox.FunctionName(title, message [, options])

Parameters:

FunctionName: This is the name of the appropriate message box function.

title: This is the text to be displayed in the title bar of a message box.

message: This is the text to be displayed as a message.

options: options are alternative choices that you may use to tailor a standard message box. Some of the options that you can use are default and parent. The default option is used to specify the default button, such as ABORT, RETRY, or IGNORE in the message box. The parent option is used to specify the window on top of which the message box is to be displayed.

You could use one of the following functions with dialogue box:

showinfo()

showwarning()

showerror()

askquestion()

askokcancel()

askyesno()

askretrycancel()

85 questions
3
votes
1 answer

Change tkMessageBox "askyesno" button names

How can I change button names of tkMessagebox.askyesno function? Exactly I want to change yes-button text yes with other and no-button text too
godot
  • 3,422
  • 6
  • 25
  • 42
2
votes
0 answers

Pytest Tkinter Messagebox

My program generates an Alert / Message Box using the code below. import tkinter as tk from tkinter import messagebox root = tk.Tk() root.withdraw() messagebox.showwarning('End of Data', "You have reached the end of the data.") I want to run a…
LukeC92
  • 121
  • 1
  • 11
2
votes
0 answers

tkMessageBox dialog icon is duplicated in unpredictable ways

Consider: import Tkinter as tk import tkMessageBox root = tk.Tk() root.withdraw() if True: tkMessageBox.askyesno("aa", "bb?") tkMessageBox.askyesno("aa1", "bb1?") tkMessageBox.askyesno("aa2", "bb2?") When the second or the third (the results…
AlwaysLearning
  • 7,257
  • 4
  • 33
  • 68
2
votes
1 answer

tkMessageBox popup invisible when run from desktop, visible when run from boot

I am trying to write a program that allows the user to press different buttons in a full screen Tkinter GUI. The operations these buttons preform does not matter for my question, but I am having trouble creating a popup dialogue (askokcancel) to…
MikeB
  • 21
  • 1
2
votes
1 answer

Python tkMessageBox.askyesnocancel -- 3 options, boolean output?

The documentation I have seen on tkMessageBox seems to indicate a boolean return for a user choice on an askyesnocancel dialog. There are 3 options, so how can a boolean properly capture the user choice? I've tried the approach shown below where a…
Qubit1028
  • 307
  • 1
  • 4
  • 12
2
votes
1 answer

tkinter askyesno message box behaviour

messagebox.askyesno(0.0,'"{0}"{1} \n {2}\n'.format(search_analyte.get(),' is not in the database.','Add,if appropriate')) print (str(messagebox.askyesno())) if messagebox.askyesno() == True: open_second() else: …
user1478335
  • 1,769
  • 5
  • 25
  • 37
2
votes
1 answer

tkmessagebox askquestion with multiple answers

I've been trying to get tkmessagebox.askquestion to ask a question where there are more answers than 'yes' and 'no.' I know that askquestion returns a string 'yes' when yes is clicked, and I'm trying to add more buttons to that dialogue box. Can…
1
vote
1 answer

How to solve this msg.showerror problem in python tkinter?

I want to make an error message if the input of an entry is defined IntVar and we input not an IntVar such as string to the entry box. here is the code that I made: nobad_sign = tk.IntVar() nohp_sign = tk.IntVar() nobad_entry_sign = tk.Entry(frm2,…
1
vote
1 answer

Need help in identifying the mistake in my code. Tkinter messagebox not displaying desired output

def play(): wind2 = tk.Toplevel() v = tk.IntVar() ques = ["Identify the least stable ion amongst the following.", "The set representing the correct order of first ionisation potential is", "The correct order of…
1
vote
1 answer

Tkinter import problem

I suspect I've got something very simple wrong here but I can't spot what. The following code: import Tkinter as Tk Tk.tkMessageBox.showerror(message='some error') gives: AttributeError: 'module' object has no attribute 'tkMessageBox' Widgets…
lost
  • 2,210
  • 2
  • 20
  • 34
1
vote
1 answer

Open tkinter messagebox that self-destructs in the lower right corner of the screen instead of the center

The messagebox by default opens in the center of the screen: But I would like it to open at the bottom right of the screen: My original code: from tkinter import Tk from tkinter.messagebox import Message from _tkinter import…
Digital Farmer
  • 1,705
  • 5
  • 17
  • 67
1
vote
1 answer

Trying to implement two python files for alert messages

So I’m trying to implement one python file with if-conditions, and based on the condition I want to have an alert message prompt. For the 2nd python file, I wanted to keep the tkinter stuff separate so it’s cleaner for larger scale projects. I got…
1
vote
2 answers

Python TkMessageBox Question not working!

I have a button that writes output to a file. And checks if the file with that filename already exists. It is supposed to ask the user to override or not? But it is not working. If the user says No, then the program will still override the…
Don Code
  • 781
  • 3
  • 12
  • 25
1
vote
0 answers

Tkinter program closes automatically without error after closing message box

I created a tkinter GUI to allow a user to select csv files and generate graphs using matplotlib. This program works well from my IDE, but closes after creating one graph in my frozen executable (cx_freeze). The exe runs without error - it brings up…
brummel
  • 41
  • 4
1
vote
1 answer

issue with tkinter messagebox

I'm using several tkinter messageboxes in my code. But ive noticed a problem with the showinfo messageboxes I've used in my code. Basically, I want a function to be called when the ok on the messagebox is pressed. Also, the user can choose not to…
JGZ
  • 307
  • 1
  • 3
  • 13