Skip to content

Commit

Permalink
tkINTER ESC-R
Browse files Browse the repository at this point in the history
  • Loading branch information
shun60s committed May 8, 2022
1 parent 536b69c commit e05df96
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 1 deletion.
Binary file modified docs/gui_gamen.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
26 changes: 25 additions & 1 deletion gui_sampling_rate_converter.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
import os
import sys
import glob
import re
import datetime
import argparse
import threading
Expand Down Expand Up @@ -261,12 +262,35 @@ def callback1(self,):
class IORedirector(object):
def __init__(self, text_area):
self.text_area = text_area
self.line_flag = False

class StdoutRedirector(IORedirector):
def write(self,st):
self.text_area.insert('end', st)
if 1: # esc-r
# check if there is num/num in st
if re.search(r' \d+/\d+',st) is not None:
#
if not self.line_flag: # start...
self.text_area.insert('end', st)
self.text_area.insert('end', "\n") # make index up
self.line_flag=True
else:
# delete last 1 line
self.text_area.delete("end-2l", "end-1l")
#
self.text_area.insert('end', st)
self.text_area.insert('end', "\n") # make index up
else:
#self.text_area.insert('end', pos +'>' + st)
self.text_area.insert('end', st )
if st != "":
self.line_flag = False # reset line_flag
else:
self.text_area.insert('end', st)

self.text_area.see("end")


def flush(self):
pass

Expand Down

0 comments on commit e05df96

Please sign in to comment.