def __init__(self, parent, mainWindow, **kwargs): tk.Frame.__init__(self, parent, **kwargs) self.parent = parent self.mainWindow = mainWindow self.columnconfigure(2, weight=1) self.gridColumns = settings.getLabelColumns() self.labels = settings.getLabels() tk.Label(self, text="左边的标签会显示在绘图窗口的左边.\n" + "右边的标签会显示在绘图窗口的右边.\n\n" + "你可以通过拖动来将标签放在你想要的相对位置." ).grid(row="0", column="1", columnspan="5", pady=10) tk.Label(self, text="通过大箭头来移动整列." ).grid(row="3", column="1", columnspan="5") tk.Label(self, text="数值为标签显示的小数点位数设定. 0则为只有整数.\n" + "在方形选框中打勾可将此标签的数值单位改为千.\n\n" + "例如, 如果你选择了三位小数, 并在方框中打勾, 则数值1,234会显示为1.234K" ).grid(row="100", column="1", columnspan="5", pady=10) tk.Frame(self, height="1", width="10").grid(row="1",column="2") self.makeArrowButtons() self.makeGrids()
def initializeLabels(self): self.labelSettings = settings.getLabels() self.labelColumns = settings.getLabelColumns() for index in self.labels: self.labels[index]["label"] = Label( self, text=self.labels[index]["text"], settings=self.labelSettings[index], background="black") textLabel = tk.Label(self.labels[index]["label"], text=self.labels[index]["text"], fg="white", background="black") if self.labelSettings[index]["column"] >= self.labelColumns[0]: column = self.labelSettings[index]["column"] + 10 else: column = self.labelSettings[index]["column"] self.labels[index]["label"].grid( row=self.labelSettings[index]["row"], column=column, sticky="n") self.labels[index]["label"].grid_remove() self.makeAllChildrenDraggable(self)
def __init__(self, parent, mainWindow, **kwargs): tk.Frame.__init__(self, parent, **kwargs) self.parent = parent self.mainWindow = mainWindow self.columnconfigure(2, weight=1) self.gridColumns = settings.getLabelColumns() self.labels = settings.getLabels() tk.Label(self, text="在左侧格的标签将会被固定在窗口的左侧," + "在右侧格的标签将会被固定在窗口的右侧。\n\n" + "你可以拖拽标签,将标签移动到到表格中的不同位置。" ).grid(row="0", column="1", columnspan="5", pady=10) tk.Label(self, text="使用箭头来让标签列从窗口的一侧移至另一侧。" ).grid(row="3", column="1", columnspan="5") tk.Label(self, text="设置数字框可以改变标签采用的小数点位置。0为没有小数点。\n" + "勾选复选框\"K\"可将数值以千为单位显示。\n\n" + "例如,如果将小数点位置设置为3并勾选复选框,则数值1,234将会显示为1.234K。" ).grid(row="100", column="1", columnspan="5", pady=10) tk.Frame(self, height="1", width="10").grid(row="1",column="2") self.makeArrowButtons() self.makeGrids()
def __init__(self, parent, mainWindow, **kwargs): tk.Frame.__init__(self, parent, **kwargs) self.parent = parent self.mainWindow = mainWindow self.columnconfigure(2, weight=1) self.gridColumns = settings.getLabelColumns() self.labels = settings.getLabels() tk.Label(self, text="Labels on the left grid will be attached to the left side of the window.\n" + "Labels on the right grid will be attached to the right side of the window.\n\n" + "You can drag and drop labels to move them to a different position in the grid." ).grid(row="0", column="1", columnspan="5", pady=10) tk.Label(self, text="Use the arrows to move columns from one side of the window to another." ).grid(row="3", column="1", columnspan="5") tk.Label(self, text="The number box represents how many decimal places the label will use. 0 is no decimal places.\n" + "The checkbox is to represent the number in thousands.\n\n" + "For instance, if you choose '3' decimals, and check the box, the number 1,234 will show as 1.234K" ).grid(row="100", column="1", columnspan="5", pady=10) tk.Frame(self, height="1", width="10").grid(row="1",column="2") self.makeArrowButtons() self.makeGrids()
def __init__(self, parent, labels=None, labelSettings=None, **kwargs): tk.Frame.__init__(self, parent, **kwargs) self.columnconfigure(9, weight="1") self.labels = labels or self.labels self.labelSettings = labelSettings or settings.getLabels() self.labelColumns = [1] if labels else settings.getLabelColumns() tk.Frame(self, width="1", height="1", background="black").grid(row="0", column="9", rowspan="10") self.initializeLabels()
def redoLabels(self): self.labelSettings = settings.getLabels() self.labelColumns = settings.getLabelColumns() for item in self.labels: self.labels[item]["label"].destroy() self.initializeLabels()