Skip to content
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

UI/UX #16

Open
tebeka opened this issue May 19, 2018 · 2 comments
Open

UI/UX #16

tebeka opened this issue May 19, 2018 · 2 comments

Comments

@tebeka
Copy link
Owner

tebeka commented May 19, 2018

Add a chapter on UI/UX (suggested by Markus Monderkamp)

Frameworks:

  • Qt
  • Tkinter
  • FLTK
  • wx
  • curses
  • web
@frayoyo
Copy link

frayoyo commented May 21, 2018

Thank you for mentioning UIX-concepts for Python:

@frayoyo
Copy link

frayoyo commented May 30, 2018

Who doesn't want to fiddle with UIX-Details uses builders when he comes from groovy/Java.

In Python applies according builders:
(https://stackoverflow.com/questions/11977279/builder-pattern-equivalent-in-python)
In Python a Builder pattern is not needed
Python supports named parameters, so this is not necessary. You can just define a class's constructor:

class SomeClass(object):

    def __init__(self, foo="default foo", bar="default bar", baz="default baz"):
        # do something

and call it using named parameters:

s = SomeClass(bar=1, foo=0)

Example: StringBuilder

A related pattern is Java's StringBuilder, which is used to efficiently construct an (immutable) String in stages. In Python, this can be replaced with str.join. For example:

final StringBuilder sb = new StringBuilder();
for(int i = 0; i < 100; i++)
    sb.append("Hello(" + i + ")");
return sb.toString();

can be replaced with

return "".join("Hello({})".format(i) for i in range(100))

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants