小编luc*_*n_v的帖子

Bash 脚本搜索文件并在每找到 10 个文件时休眠

我正在尝试编写一个循环遍历文件夹及其子文件夹并打印文件的 bash 脚本。这部分正在工作,但我尝试将这部分置于 if 条件下,但似乎我无法..

我想要的是,每发现 10 个文件就休眠 10 秒,然后从剩下的位置重新开始(继续)..

这就是我所做的

#!/bin/bash

declare -i x=0
    
if (( $x < 10  )); then
    
find /myfolder -type f -maxdepth 5 | while read file; do
  echo $file;
  ((x++))
echo $x;

done

else

echo "found 10";
sleep 10;
$x=0;

fi
Run Code Online (Sandbox Code Playgroud)

bash

1
推荐指数
1
解决办法
289
查看次数

Tkinter 实时更新变量

我有这个代码显示一个页面,然后当按下 PAGE1 按钮时转到其他框架。在这里,我想在任何标签中显示时间,但我希望它自动更新。我不能自己做

import Tkinter as tk
from Tkinter import *
import time
import datetime

def clock():
    time = datetime.datetime.now().strftime("Time: %H:%M:%S")
    print time

class MainApp(tk.Tk):

    def __init__(self, *args, **kwargs):
        tk.Tk.__init__(self, *args, **kwargs)

        container = tk.Frame(self)
        container.pack(side="top", fill="both", expand=True)
        container.grid_rowconfigure(0, weight=1)
        container.grid_columnconfigure(0, weight=1)

        self.frames = {}
        for F in (MainPage, page1, help):
            page_name = F.__name__
            frame = F(parent=container, controller=self)
            self.frames[page_name] = frame
            frame.grid(row=0, column=0, columnspan=12,sticky="nsew")
            frame.grid_columnconfigure(0, weight=1)
            frame.grid_columnconfigure(1, weight=1)
            frame.grid_columnconfigure(2, weight=1)
            frame.grid_columnconfigure(3, weight=1)
            frame.grid_columnconfigure(4, weight=1)
            frame.grid_columnconfigure(5, weight=1)
            frame.grid_columnconfigure(6, weight=1)
            frame.grid_columnconfigure(7, weight=1) …
Run Code Online (Sandbox Code Playgroud)

python tkinter

-1
推荐指数
1
解决办法
6391
查看次数

标签 统计

bash ×1

python ×1

tkinter ×1