我在 Python 3.5.1 上使用图形工具。我有一个单词图,在押韵的单词之间有边缘。当我使用graph-tool的draw函数时,如果顶点设置太大,会导致所有顶点重叠,但是如果它们太小,我必须将字体变小,然后难以辨认。有没有办法设置最小边长或强制顶点不重叠?
代码示例:
import graph_tool.all as gt
G = gt.load_graph("G.gt")
gt.graph_draw(G, vertex_text=G.vertex_properties.word, vertex_font_size=10, output_size=(1000, 1000), output="G.png", vertexsize=10)
Run Code Online (Sandbox Code Playgroud)
我对 bash 或 vbs 知之甚少。我正在尝试制作一个脚本,该脚本将自动解压缩名为“dungeon.zip”的 zip,其中包含我编写的一个小游戏。我想将其解压缩到 zip 文件所在目录中的一个名为 dungeon 的文件夹中。我使用了此答案中的代码,并将这些文件替换为我的文件:
strZipFile = "dungeon.zip"
strUnzipped = "dungeon\"
Sub UnZip(ExtractTo,ZipFile)
Set fso = CreateObject("Scripting.FileSystemObject")
If NOT fso.FolderExists(ExtractTo) Then
fso.CreateFolder(ExtractTo)
End If
Set objShell = CreateObject("Shell.Application")
Set FilesInZip=objShell.NameSpace(ZipFile).items
ObjShell.NameSpace(ExtractTo).CopyHere(FilesInZip)
Set fso = Nothing
Set objShell = Nothing
End Sub
set WshShell = WScript.CreateObject("WScript.Shell")
strDesktop = WshShell.SpecialFolders("MyDocuments")
strZipPath = strDesktop & strZipFile
strUnzipPath = strDesktop & strUnzipped
UnZip strUnzipPath , strZipPath
Run Code Online (Sandbox Code Playgroud)
正如他的回答一样,我从 cmd 文件运行 .vbs:
cscript UnzipZip.vbs
Run Code Online (Sandbox Code Playgroud)
这是错误:
C:\Users\Brett\Downloads\UnzipZip.vbs(12, 1) Microsoft VBScript …Run Code Online (Sandbox Code Playgroud) while x <= 9:
result = usertype()
if result == 'Correct':
Run Code Online (Sandbox Code Playgroud)
我在"result = usertype()"的结果"t"上收到缩进错误.有人能解释一下吗?
*编辑我试过重写它,我检查确保所有的缩进确实是缩进而不是空格.现在变得非常沮丧和困惑.我认为它可能是导致问题的前一行中的某些内容.
*编辑2从命令提示符复制错误,因为IDLE对我不起作用:
File "<stdin>", line 5
result = usertype()
^
IndentationError: expected an indented block
>>> if result == 'Correct':
File "<stdin>", line 1
if result == 'Correct':
^
IndentationError: unexpected indent
>>> x = x + 1
File "<stdin>", line 1
x = x + 1
^
IndentationError: unexpected indent
>>> y = y + 5
File "<stdin>", line 1
y = y + 5 …Run Code Online (Sandbox Code Playgroud) python ×2
cmd ×1
graph ×1
graph-tool ×1
indentation ×1
syntax ×1
syntax-error ×1
unzip ×1
vbscript ×1
while-loop ×1
zip ×1