-
It's a semi-translation, because the reason for the error is already given in the dialog box.
Hints that you have a problem with your indentation (note that python distinguishes between blocks by indentation), or that you may have a mix of tab and space for indentation.
If it's a type 2 error (using a mix of tab and spaces for indentation), you can select all and then click the format ->untabify region menu to select a new indentation.
-
Like 1l says, import the sys module and then it's a list.
The content is all there is to it.
The default is your python script itself.
After that, it's the parameters you add later.
It's hard to give examples ...... how to do it
Because no one is going to have a hard time analyzing parameters, this step will not become the core function of a script.
If you have to see examples, you can do this in my blog:
The main point in the main program is the beginning of the main function, which is processing parameters.
I've also written scripts with complex processing parameters, but I can't release them because they may involve some confidential content......Sorry
-
It uses the main function to automatically close the main window when the program is finished
from tkinter import *def main():
root = tk()
b = button(root, text='Exit', command=
mainloop()if __name__ == '__main__':
main()
-
Because mainloop() didn't receive a message to exit the loop.
Call when you've completed a task to exit the loop. The same goes for the x in the top right corner.
-
Tkinter is a standard Python GUI library. The combination of Python and Tkinter provides a quick and easy way to create GUI applications, and Tkinter provides a powerful object-oriented interface to the TK GUI Toolkit.
python can open a file with the open command, for example:
eBook txt text.
f = open('e:\\',encoding='utf-8')
raw =
-
You're talking about "Open File Dialog", which requires the filedialog module, which is very simple
from tkinter import *from filedialog import *root = tk()
fd = loadfiledialog(root) to create an open file dialog.
filename = Displays the Open File dialog box and gets the selected file name Print filename
-
First you need to import the filedialog package from tkinter ** as follows from tkinter import filedialog, and then you create a button object in tk(), b = , text='Select the file', command=key in the button to give a response event is to press the button to call the function, here command=openfile, and then write a method to respond, for example.
def openfile():
fname = "Open the file")
return fname
In this way, the name of the file to be opened is stored in the variable fname as a string, and the file path can be obtained by outputting fname.
-
mainloop(), the window will not refresh without events.
Try this: from tkinter import *root = tk().
for i in range(1, 101):
val = str(i)
label(root, textvariable = val).pack()
-
Assuming that the label is a and the window as a whole is root, you can lay it out first, and then use a['text']=...And.
-
You can create a font object. Import the tkfont module and use the construct of its font class:
import tkfont
font = ( option, .
Here's a list of options:
family: The name of the font family as a string.
size: As an integer, the height of the dot font. To get the n pixels high of the font, use -n
weight: "bold" for boldface, "normal" for regular weight.
slant: "italic" for italic, "roman" for unslanted.
underline: 1 for underlined text, 0 for normal.
overstrike: 1 for overstruck text, 0 for normal.
Example: helv36="helvetica",size=36,weight="bold")
Endorsement is very powerful, and that's because you yourself are seriously memorizing it, but forgetfulness in life is caused by you not caring about some things in life, and you don't take them to heart.
1. Open the 3DMAX software, select Create, Spline, Circle. >>>More
It's too abstract, this is your ** proposition, right?
It means it's time for you to change your computer, throw this one away.
I fell in love in high school, and my girlfriend went to dinner hand in hand, and I met my homeroom teacher, and I bumped head-on, and my homeroom teacher found me first, so I quickly pretended not to see it, and turned over and over the dishes in my hand until I passed by. According to the reliable reports of the classmates, they saw their homeroom teacher walking behind us twice, and they were afraid that we would be embarrassed to bump into each other, so they walked slowly behind silently. My high school physics is okay, I am the representative of the physics class, the physics teachers of the grade are in the same office, once a few days after the exam, when I went to pick up the homework, the physics teacher in their class pulled me and said, when will you give tutoring to your family, she is like that, you are not in a hurry? >>>More