[proxy] web.archive.org← back | site home | direct (HTTPS) ↗ | proxy home | ◑ dark◐ light
/ cpython Public
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

bpo-25237: Documentation for tkinter modules #1870

Merged
merged 17 commits into from Sep 10, 2019

Conversation

Copy link
Contributor

patel-nikhil commented May 30, 2017

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

Copy link

mention-bot commented May 30, 2017

@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.

Copy link
Member

vadmium left a comment

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.

Doc/library/tkinter.colorchooser.rst Outdated Show resolved Hide resolved
Doc/library/tkinter.commondialog.rst Outdated Show resolved Hide resolved
Doc/library/tkinter.dnd.rst Outdated Show resolved Hide resolved
Doc/library/tkinter.colorchooser.rst Outdated Show resolved Hide resolved
Doc/library/tkinter.messagebox.rst Outdated Show resolved Hide resolved
Doc/library/tkinter.filedialog.rst Outdated Show resolved Hide resolved
Doc/library/tkinter.font.rst Outdated Show resolved Hide resolved
Doc/library/tkinter.font.rst Outdated Show resolved Hide resolved
Doc/library/tkinter.font.rst Outdated Show resolved Hide resolved
Doc/library/tkinter.messagebox.rst Outdated Show resolved Hide resolved
Copy link
Contributor Author

patel-nikhil commented Jun 1, 2017

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

Copy link
Member

ned-deily commented Jun 2, 2018

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

Doc/library/tkinter.colorchooser.rst Outdated Show resolved Hide resolved

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

Copy link
Contributor

roseman Jun 2, 2018

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


.. seealso::

:mod:`tkinter.commondialog`, :ref:`tut-files`
Copy link
Contributor

roseman Jun 2, 2018

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
Contributor

roseman Jun 2, 2018

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
Member

terryjreedy Jun 23, 2018

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)
Copy link
Contributor

roseman Jun 2, 2018

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
Member

terryjreedy Jun 23, 2018

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.

Doc/library/tkinter.simpledialog.rst Outdated Show resolved Hide resolved
Copy link
Contributor

roseman left a comment

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

Copy link
Contributor Author

patel-nikhil commented Jun 3, 2018

@roseman thanks for all the feedback!

Copy link
Sponsor Contributor

willingc commented Jun 5, 2018

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

Copy link
Contributor

roseman commented Jun 5, 2018

Looks good to me! @willingc

Copy link
Contributor Author

patel-nikhil commented Jun 6, 2018

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

Copy link
Member

terryjreedy left a comment

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).

Doc/library/tkinter.colorchooser.rst Outdated Show resolved Hide resolved

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

Copy link
Member

terryjreedy Jun 23, 2018

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.

Doc/library/tkinter.messagebox.rst Outdated Show resolved Hide resolved
Doc/library/tkinter.commondialog.rst Outdated Show resolved Hide resolved
Doc/library/tkinter.dnd.rst Outdated Show resolved Hide resolved
Doc/library/tkinter.font.rst Outdated Show resolved Hide resolved
Doc/library/tkinter.messagebox.rst Outdated Show resolved Hide resolved
askokcancel(title=None, message=None, **options)
askretrycancel(title=None, message=None, **options)
askyesno(title=None, message=None, **options)
askyesnocancel(title=None, message=None, **options)
Copy link
Member

terryjreedy Jun 23, 2018

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.

Doc/library/tkinter.rst Show resolved Hide resolved
Doc/library/tkinter.scrolledtext.rst Outdated Show resolved Hide resolved
serhiy-storchaka self-requested a review Oct 6, 2018
Copy link
Member

serhiy-storchaka left a comment

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

Doc/library/tkinter.colorchooser.rst Outdated Show resolved Hide resolved
@@ -33,14 +33,19 @@ alternatives, see the :ref:`other-gui-packages` section.
.. toctree::

tkinter.rst
tkinter.colorchooser.rst
Copy link
Member

serhiy-storchaka Oct 8, 2018

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
Contributor Author

patel-nikhil Oct 10, 2018

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.

Freezing Tkinter applications


Freezing Tkinter applications
Copy link
Member

serhiy-storchaka Oct 8, 2018

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
Contributor Author

patel-nikhil Oct 10, 2018

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.

Doc/library/tkinter.colorchooser.rst Outdated Show resolved Hide resolved
Doc/library/tkinter.dnd.rst Outdated Show resolved Hide resolved
Doc/library/tkinter.dnd.rst Outdated Show resolved Hide resolved
Copy link
Contributor Author

patel-nikhil commented Nov 14, 2018

I have made the requested changes; please review again

1 similar comment
Copy link
Contributor Author

patel-nikhil commented Feb 10, 2019

I have made the requested changes; please review again

Copy link

bedevere-bot commented Feb 10, 2019

Thanks for making the requested changes!

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

matrixise added the docs Documentation in the Doc dir label May 15, 2019
Copy link
Member

JulienPalard left a comment

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?

Doc/library/tkinter.dnd.rst Outdated Show resolved Hide resolved
Doc/library/dialog.rst Outdated Show resolved Hide resolved
Doc/library/tkinter.messagebox.rst Outdated Show resolved Hide resolved
Doc/library/dialog.rst Outdated Show resolved Hide resolved
Doc/library/tkinter.font.rst Outdated Show resolved Hide resolved
Doc/library/tkinter.font.rst Outdated Show resolved Hide resolved
**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
Member

JulienPalard Sep 9, 2019

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
Contributor Author

patel-nikhil Sep 9, 2019

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
Member

JulienPalard Sep 10, 2019

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 👍

Copy link

bedevere-bot commented Sep 9, 2019

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.

Copy link
Contributor Author

patel-nikhil commented Sep 9, 2019

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.

Copy link

bedevere-bot commented Sep 9, 2019

Thanks for making the requested changes!

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

Copy link
Member

terryjreedy commented Sep 10, 2019

I leave it a final review to Julien

JulienPalard merged commit 80428ed into python:master Sep 10, 2019
Copy link
Member

JulienPalard commented Sep 10, 2019

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

@@ -0,0 +1,230 @@
Tkinter Dialogs
Copy link
Member

zware Sep 10, 2019

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?

websurfer5 pushed a commit to websurfer5/cpython that referenced this pull request Jul 20, 2020
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.

None yet