Howtos And Tutorials



  • Do not worry if this is your first time using MuleSoft, this tutorial will walk you through step by step on how to develop, test, and deploy your first Mule Application in just a few minutes! Once your application is deployed, test your application using your favorite REST client by making a simple POST request to your hosted API on CloudHub.
  • Boxshot Tutorials. These tutorials help you take your first steps in Boxshot, grow your skills, and complete really cool projects. Step by step, chapter by chapter you will learn all of Boxshot powerful features. User Interface Basics. Here you can read about Boxshot user interface layout, panels and basic operations.
  • Linoxide is a blog website that publishes the World's best quality Linux tutorials and articles by a team of Linux experts.
Main Menu
  • HOWTOs

Well today, I'm revisiting the process of making the undies and sharing the template and tutorial so you can make a pair or two or three of your own. (for those of you who adore the t-shirt, keep your eyes peeled for the pattern in my upcoming book with Interweave later this fall/winter!).

How

HOWTOs are detailed documents describing 'how to' accomplish something specific. Most of them will assume a basic understanding of the WoW scripting language and framework. For more information on the framework please refer to Project:Interface customization, AddOns, and World of Warcraft API.

This list may be incomplete; all HOWTOs are listed on Category:HOWTOs.

Getting Started

Create a WoW AddOn in under 15 Minutes
Creating a Hello World addon.
Viewing Blizzard's interface code
The default UI is shipped as if it were a collection of dozens of addons, and this is how you see the source.
Using the BigWigs Packager with GitHub Actions
Automate your addon development workflow.

General Lua tutorials

Common Lua shortcuts
Commonly occurring uses of Lua logic evaluation short-cuts, method syntax and the global environment.
Hooking functions
Functions are first-class values in Lua, which allows you to override or extend the behavior of already declared functions.
Pattern matching
An overview of the regular expression features of Lua.

General Addon tutorials

Getting the current interface number
For use in .toc files.
Handling events
Creating, and managing event handler code.
Saving variables between game sessions
Description and examples of saving variables to disk.
Creating defaults
Creating default values in your addon's saved variables.
Creating key bindings
Creating user-configurable bindings, using the Bindings.xml, Lua, or RestrictedEnvironment APIs.
Localizing an addon
General techniques enabling localization.
Using the AddOn namespace
Sharing data privately between multiple Lua files in the same AddOn.

Using FrameXML

Creating a slash command
Creating and using slash command handlers.
Creating standard left-sliding frames
using the UIPanelLayout attributes to manage your frame's position.
Make frames closable with the Escape key
using UISpecialFrames to enable this behavior.
Creating simple pop-up dialog boxes
Using StaticPopup to display simple prompts.
Using the ColorPickerFrame
Invoking the default color picker.
Using UIDropDownMenu
Drop down boxes and menus using the FrameXML API.
Using the Interface Options Addons panel
Describes how to create an option panel that works with the default UI's Interface Options frame.

Widgets

Making draggable frames
Describes several methods to allow the user to move a frame.
Making resizable frames
Shows how to create a frame that can be resized using the mouse.

See also

  • Making a macro : An overview of the various macro slash commands.
Retrieved from 'https://wow.gamepedia.com/HOWTOs?oldid=5938343'
author

Tshepang Lekhonkhobe

This tutorial is intended to be a gentle introduction to argparse, therecommended command-line parsing module in the Python standard library.

Note

There are two other modules that fulfill the same task, namelygetopt (an equivalent for getopt() from the Clanguage) and the deprecated optparse.Note also that argparse is based on optparse,and therefore very similar in terms of usage.

Concepts¶

Let’s show the sort of functionality that we are going to explore in thisintroductory tutorial by making use of the ls command:

A few concepts we can learn from the four commands:

  • The ls command is useful when run without any options at all. It defaultsto displaying the contents of the current directory.

  • If we want beyond what it provides by default, we tell it a bit more. Inthis case, we want it to display a different directory, pypy.What we did is specify what is known as a positional argument. It’s named sobecause the program should know what to do with the value, solely based onwhere it appears on the command line. This concept is more relevantto a command like cp, whose most basic usage is cpSRCDEST.The first position is what you want copied, and the secondposition is where you want it copied to.

  • Now, say we want to change behaviour of the program. In our example,we display more info for each file instead of just showing the file names.The -l in that case is known as an optional argument.

  • That’s a snippet of the help text. It’s very useful in that you cancome across a program you have never used before, and can figure outhow it works simply by reading its help text.

The basics¶

Let us start with a very simple example which does (almost) nothing:

Following is a result of running the code:

Here is what is happening:

  • Running the script without any options results in nothing displayed tostdout. Not so useful.

  • The second one starts to display the usefulness of the argparsemodule. We have done almost nothing, but already we get a nice help message.

  • The --help option, which can also be shortened to -h, is the onlyoption we get for free (i.e. no need to specify it). Specifying anythingelse results in an error. But even then, we do get a useful usage message,also for free.

Introducing Positional arguments¶

An example:

Howtos And Tutorials Face Mask

And running the code:

Here is what’s happening:

  • We’ve added the add_argument() method, which is what we use to specifywhich command-line options the program is willing to accept. In this case,I’ve named it echo so that it’s in line with its function.

  • Calling our program now requires us to specify an option.

  • The parse_args() method actually returns some data from theoptions specified, in this case, echo.

  • The variable is some form of ‘magic’ that argparse performs for free(i.e. no need to specify which variable that value is stored in).You will also notice that its name matches the string argument givento the method, echo.

Note however that, although the help display looks nice and all, it currentlyis not as helpful as it can be. For example we see that we got echo as apositional argument, but we don’t know what it does, other than by guessing orby reading the source code. So, let’s make it a bit more useful:

And we get:

Now, how about doing something even more useful:

Following is a result of running the code:

That didn’t go so well. That’s because argparse treats the options wegive it as strings, unless we tell it otherwise. So, let’s tellargparse to treat that input as an integer:

Following is a result of running the code:

That went well. The program now even helpfully quits on bad illegal inputbefore proceeding.

Introducing Optional arguments¶

So far we have been playing with positional arguments. Let ushave a look on how to add optional ones:

And the output:

Here is what is happening:

  • The program is written so as to display something when --verbosity isspecified and display nothing when not.

  • To show that the option is actually optional, there is no error when runningthe program without it. Note that by default, if an optional argument isn’tused, the relevant variable, in this case args.verbosity, isgiven None as a value, which is the reason it fails the truthtest of the if statement.

  • The help message is a bit different.

  • When using the --verbosity option, one must also specify some value,any value.

How To Tutorials In Vcarve Desktop

The above example accepts arbitrary integer values for --verbosity, but forour simple program, only two values are actually useful, True or False.Let’s modify the code accordingly:

And the output:

Here is what is happening:

  • The option is now more of a flag than something that requires a value.We even changed the name of the option to match that idea.Note that we now specify a new keyword, action, and give it the value'store_true'. This means that, if the option is specified,assign the value True to args.verbose.Not specifying it implies False.

  • It complains when you specify a value, in true spirit of what flagsactually are.

  • Notice the different help text.

Short options¶

How To Tutorials In Doodly

If you are familiar with command line usage,you will notice that I haven’t yet touched on the topic of shortversions of the options. It’s quite simple:

And here goes:

Note that the new ability is also reflected in the help text.

Combining Positional and Optional arguments¶

Our program keeps growing in complexity:

And

And now the output:

  • We’ve brought back a positional argument, hence the complaint.

  • Note that the order does not matter.

How about we give this program of ours back the ability to havemultiple verbosity values, and actually get to use them:

And the output:

These all look good except the last one, which exposes a bug in our program.Let’s fix it by restricting the values the --verbosity option can accept:

And the output:

Note that the change also reflects both in the error message as well as thehelp string.

Now, let’s use a different approach of playing with verbosity, which is prettycommon. It also matches the way the CPython executable handles its ownverbosity argument (check the output of python--help):

We have introduced another action, “count”,to count the number of occurrences of a specific optional arguments:

  • Yes, it’s now more of a flag (similar to action='store_true') in theprevious version of our script. That should explain the complaint.

  • It also behaves similar to “store_true” action.

  • Now here’s a demonstration of what the “count” action gives. You’ve probablyseen this sort of usage before.

  • And if you don’t specify the -v flag, that flag is considered to haveNone value.

  • As should be expected, specifying the long form of the flag, we should getthe same output.

  • Sadly, our help output isn’t very informative on the new ability our scripthas acquired, but that can always be fixed by improving the documentation forour script (e.g. via the help keyword argument).

  • That last output exposes a bug in our program.

Let’s fix:

And this is what it gives:

  • First output went well, and fixes the bug we had before.That is, we want any value >= 2 to be as verbose as possible.

  • Third output not so good.

Let’s fix that bug:

We’ve just introduced yet another keyword, default.We’ve set it to 0 in order to make it comparable to the other int values.Remember that by default,if an optional argument isn’t specified,it gets the None value, and that cannot be compared to an int value(hence the TypeError exception).

And:

You can go quite far just with what we’ve learned so far,and we have only scratched the surface.The argparse module is very powerful,and we’ll explore a bit more of it before we end this tutorial.

Getting a little more advanced¶

What if we wanted to expand our tiny program to perform other powers,not just squares:

Output:

Notice that so far we’ve been using verbosity level to change the textthat gets displayed. The following example instead uses verbosity levelto display more text instead:

Output:

Conflicting options¶

So far, we have been working with two methods of anargparse.ArgumentParser instance. Let’s introduce a third one,add_mutually_exclusive_group(). It allows for us to specify options thatconflict with each other. Let’s also change the rest of the program so thatthe new functionality makes more sense:we’ll introduce the --quiet option,which will be the opposite of the --verbose one:

Our program is now simpler, and we’ve lost some functionality for the sake ofdemonstration. Anyways, here’s the output:

That should be easy to follow. I’ve added that last output so you can see thesort of flexibility you get, i.e. mixing long form options with short formones.

Before we conclude, you probably want to tell your users the main purpose ofyour program, just in case they don’t know:

Note that slight difference in the usage text. Note the [-v|-q],which tells us that we can either use -v or -q,but not both at the same time:

Conclusion¶

The argparse module offers a lot more than shown here.Its docs are quite detailed and thorough, and full of examples.Having gone through this tutorial, you should easily digest themwithout feeling overwhelmed.