Skip to content

bpo-25237: Documentation for tkinter modules#1870

Merged
JulienPalard merged 17 commits into
python:masterfrom
patel-nikhil:bpo-25237
Sep 10, 2019
Merged

bpo-25237: Documentation for tkinter modules#1870
JulienPalard merged 17 commits into
python:masterfrom
patel-nikhil:bpo-25237

Conversation

@patel-nikhil

@patel-nikhil patel-nikhil commented May 30, 2017

Copy link
Copy Markdown
Contributor

Added documentation for tkinter modules where none existed

  • tkinter.colorchooser
  • tkinter.commondialog
  • tkinter.filedialog
  • tkinter.messagebox
  • tkinter.simpledialog
  • tkinter.dnd

https://bugs.python.org/issue25237

@mention-bot

Copy link
Copy Markdown

@NP123, thanks for your PR! By analyzing the history of the files in this pull request, we identified @birkenfeld, @ezio-melotti and @berkerpeksag to be potential reviewers.

@vadmium vadmium left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I left comments for basic things that stuck out. There are also opportunities to clarify the stub text, add more detail, and organize it, but this looks like a decent start.

Comment thread Doc/library/tkinter.colorchooser.rst Outdated
Comment thread Doc/library/tkinter.commondialog.rst Outdated
Comment thread Doc/library/tkinter.dnd.rst Outdated
Comment thread Doc/library/tkinter.colorchooser.rst Outdated
Comment thread Doc/library/tkinter.messagebox.rst Outdated
Comment thread Doc/library/tkinter.filedialog.rst Outdated
Comment thread Doc/library/tkinter.font.rst Outdated
Comment thread Doc/library/tkinter.font.rst Outdated
Comment thread Doc/library/tkinter.font.rst Outdated
Comment thread Doc/library/tkinter.messagebox.rst Outdated
@patel-nikhil

Copy link
Copy Markdown
Contributor Author

Thanks for the critique; my apologies for the spelling and grammatical errors. I am working towards revising and improving it.

@ned-deily

Copy link
Copy Markdown
Member

@vadmium Are you OK with the changes? @roseman Would you be willing to review the proposed changes?

Comment thread Doc/library/tkinter.colorchooser.rst Outdated

The *askcolor* method is a factory method that creates a color choosing
dialog.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should add that this call will wait for the user to make a selection, and then will return the color selected (or None) to the caller

Comment thread Doc/library/tkinter.filedialog.rst Outdated

.. seealso::

:mod:`tkinter.commondialog`, :ref:`tut-files` No newline at end of file

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would suggest putting the ask* functions first, since those are the preferred interface. For each, mention that these are modal dialogs, also that return value may be None.

As for Directory()/FileDialog() and friends, I'd rather see these after the interfaces that people use, and should explicitly say that they create these dialogs from scratch and they don't resemble the platform ones. (They should also probably be deprecated, but that's a separate issue)


The :mod:`tkinter.font` module provides the :class:`Font` class for creating
and using named fonts.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The whole idea of "named fonts" is a bit of a cognitive mismatch with font objects, i.e. from the Python point of view you just want a font object, and it being a "named" font doesn't make a lot of sense. (In Tk, the string name of the font plays the same role as an object reference). Could you add something like "Named fonts are Tk's way of defining a font as a single object, rather than specifying the font each time as a list of font attributes."?

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I agree with this addition.

askokcancel(title=None, message=None, **options)
askretrycancel(title=None, message=None, **options)
askyesno(title=None, message=None, **options)
askyesnocancel(title=None, message=None, **options) No newline at end of file

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Again, just to mention that these are all modal so the calls complete after the user dismisses the dialogs. Return values vary with the type of message box created, which will be some subset of ok, cancel, yes, no, retry, abort, ignore.

In the synopsis I would probably refer to these as "alert" dialogs, which is the more familiar name.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I suggested a synopsis change. The returns for each functions should be specified. The last four can be covered with
Return one of the alternatives in the function name after display a box.
What does askquestion return? An answer the user enters? If so, the synopsis needs a further change.

Comment thread Doc/library/tkinter.simpledialog.rst Outdated

@roseman roseman left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you very much for doing this! Detailed comments are mostly either small clarifications or additions, or suggestions for emphasizing or deemphasizing certain parts.

@patel-nikhil

Copy link
Copy Markdown
Contributor Author

@roseman thanks for all the feedback!

@willingc

willingc commented Jun 5, 2018

Copy link
Copy Markdown
Contributor

Thanks for the review @roseman and for the persistence on the PR @NP123.

When you are both happy with the PR, please ping me for core review. Thanks.

cc/ @serhiy-storchaka FYI as tkinter expert

@roseman

roseman commented Jun 5, 2018

Copy link
Copy Markdown
Contributor

Looks good to me! @willingc

@patel-nikhil

Copy link
Copy Markdown
Contributor Author

@roseman thanks again. Thanks @willingc - please review when you get the chance. Any and all feedback will be appreciated.

@terryjreedy terryjreedy left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I presume this is based on docstrings. Missing one (like for class.init) need to be filled in. Pre-PEP8 style (passive verbs) needs to be changed (to active verbs).

Comment thread Doc/library/tkinter.colorchooser.rst Outdated

The :mod:`tkinter.font` module provides the :class:`Font` class for creating
and using named fonts.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I agree with this addition.

Comment thread Doc/library/tkinter.messagebox.rst Outdated
Comment thread Doc/library/tkinter.commondialog.rst Outdated
Comment thread Doc/library/tkinter.dnd.rst Outdated
Comment thread Doc/library/tkinter.font.rst Outdated
Comment thread Doc/library/tkinter.messagebox.rst Outdated
askokcancel(title=None, message=None, **options)
askretrycancel(title=None, message=None, **options)
askyesno(title=None, message=None, **options)
askyesnocancel(title=None, message=None, **options) No newline at end of file

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I suggested a synopsis change. The returns for each functions should be specified. The last four can be covered with
Return one of the alternatives in the function name after display a box.
What does askquestion return? An answer the user enters? If so, the synopsis needs a further change.

Comment thread Doc/library/tkinter.rst
Comment thread Doc/library/tkinter.scrolledtext.rst Outdated
@serhiy-storchaka serhiy-storchaka self-requested a review October 6, 2018 19:51

@serhiy-storchaka serhiy-storchaka left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I suggest to merge the documentation for all dialog related modules into a single page.

Comment thread Doc/library/tkinter.colorchooser.rst Outdated
Comment thread Doc/library/tk.rst
.. toctree::

tkinter.rst
tkinter.colorchooser.rst

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think it would be better to merge the documentation for all dialog related modules into a single page.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

By these do you mean {commondialog, dialog, simpledialog} only? I feel the filedialog and colorchooser modules each have distinct enough functionality and usage that it would be cleaner to keep them separate.

Comment thread Doc/library/tk.rst
Freezing Tkinter applications


Freezing Tkinter applications No newline at end of file

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What is changed here?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

3 trailing blank lines that were present in the existing version were removed for consistent formatting. They caused a warning\error in the CI build, being flagged as trailing whitespace.

Comment thread Doc/library/tkinter.colorchooser.rst Outdated
Comment thread Doc/library/tkinter.dnd.rst Outdated
Comment thread Doc/library/tkinter.dnd.rst Outdated
@patel-nikhil

patel-nikhil commented Nov 14, 2018

Copy link
Copy Markdown
Contributor Author

I have made the requested changes; please review again

1 similar comment
@patel-nikhil

Copy link
Copy Markdown
Contributor Author

I have made the requested changes; please review again

@bedevere-bot

Copy link
Copy Markdown

Thanks for making the requested changes!

@terryjreedy: please review the changes made to this pull request.

@matrixise matrixise added the docs Documentation in the Doc dir label May 15, 2019

@JulienPalard JulienPalard left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi @patel-nikhil! Thanks for this huge piece of documentation. I marked as resolved all previous reviews that you successfully resolved, but ther's still some opened reviews. I also had to replicate some (half-fixed ones typically).

Can you take a look at it?

Comment thread Doc/library/tkinter.dnd.rst Outdated
Comment thread Doc/library/dialog.rst Outdated
Comment thread Doc/library/tkinter.messagebox.rst Outdated
Comment thread Doc/library/dialog.rst Outdated
Comment thread Doc/library/tkinter.font.rst Outdated
Comment thread Doc/library/tkinter.font.rst Outdated
Comment thread Doc/library/dialog.rst Outdated
**Static factory functions**

The below functions when called create a modal, native look-and-feel dialog,
wait for the user's selection, then return the selected value(s) or None to the

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
wait for the user's selection, then return the selected value(s) or None to the
wait for the user's selection, then return the selected value(s) or `None` to the

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Am I correct in assuming you mean ``None`` instead of `None` since make check gives me 1 error with severity 2 (reason: default role used) when using single backquotes to surround None

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes I meant None, thanks for proofreading my proofreading 👍

@bedevere-bot

Copy link
Copy Markdown

A Python core developer has requested some changes be made to your pull request before we can consider merging it. If you could please address their requests along with any other requests in other reviews from core developers that would be appreciated.

Once you have made the requested changes, please leave a comment on this pull request containing the phrase I have made the requested changes; please review again. I will then notify any core developers who have left a review that you're ready for them to take another look at this pull request.

@patel-nikhil

Copy link
Copy Markdown
Contributor Author

I have made the requested changes; please review again.

@JulienPalard thanks for your efforts! I've read through the remaining previously open reviews, and the changes you highlighted in your comments, and have addressed them with my latest commit.

@bedevere-bot

Copy link
Copy Markdown

Thanks for making the requested changes!

@terryjreedy, @JulienPalard: please review the changes made to this pull request.

@terryjreedy

Copy link
Copy Markdown
Member

I leave it a final review to Julien

@JulienPalard JulienPalard merged commit 80428ed into python:master Sep 10, 2019
@JulienPalard

Copy link
Copy Markdown
Member

@patel-nikhil thanks for this huge piece of documentation!

Comment thread Doc/library/dialog.rst
@@ -0,0 +1,230 @@
Tkinter Dialogs

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A bit late to the party, but may I suggest that this file be renamed to tkinter.dialog.rst?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

docs Documentation in the Doc dir

Projects

None yet

Development

Successfully merging this pull request may close these issues.