打开文件时如何防止侧边栏打开?

时间:2021-05-24 02:24:04

标签: visual-studio-code vscode-settings

我很习惯使用 import tkinter as tk import tkinter.ttk as ttk class ProgressBarPercent(tk.Frame): def __init__(self, parent, orient, length, mode): tk.Frame.__init__(self, parent) self.root = parent # ttk style self.style = ttk.Style() ## self.style.theme_use("clam") self.style.configure("green.Horizontal.TProgressbar", foreground="green", background="green") self.style.configure("blue.Horizontal.TProgressbar", foreground="blue", background="blue") self.style.configure("yellow.Horizontal.TProgressbar", foreground="yellow", background="yellow") self.style.configure("orange.Horizontal.TProgressbar", foreground="orange", background="orange") self.style.configure("red.Horizontal.TProgressbar", foreground="red", background="red") # Progressbar, percent label self.progress = ttk.Progressbar(self, orient = orient, length = length, mode = mode, style = "orange.Horizontal.TProgressbar") self.text = tk.StringVar() self.text.set("0%") self.percent = tk.Label(self, textvariable = self.text) self.percent.grid(column=0, row=0) self.progress.grid(column=1, row=0) def value(self, value): # Progressbar updates based on input value self.progress['value'] = value percent_value = round(value, 1) self.text.set(str(percent_value) + '%') alert = False if value < 25: self.progress.configure(style = "green.Horizontal.TProgressbar") elif 25 <= value < 50: self.progress.configure(style = "blue.Horizontal.TProgressbar") elif 50 <= value < 75: self.progress.configure(style = "yellow.Horizontal.TProgressbar") elif 75 <= value <= 100: self.progress.configure(style = "orange.Horizontal.TProgressbar") elif 100 <= value: alert = True self.progress.configure(style = "red.Horizontal.TProgressbar") self.alert(alert) def alert(self, alert): if alert == True: self.percent.configure(fg = 'red') else: self.percent.configure(fg = 'black') if __name__ == "__main__": root = tk.Tk() progress = ProgressBarPercent(root, orient = tk.HORIZONTAL, length = 100, mode = 'determinate') progress.grid() progress.value(67.322) root.mainloop() 打开和关闭侧边栏。我希望侧边栏大部分时间都关闭,因为我可以通过键绑定更轻松地访问文件和功能。

但是,每次我访问当前文件夹 (cmd+b) 中的文件时,它都会在侧边栏打开的新选项卡中打开该文件。

如何防止这种行为?

我曾尝试将 cmd+t 设置为 false,但这似乎有所不同。

0 个答案:

没有答案