Skip to content

Commit

Permalink
A bunch of fix and improvements (#32)
Browse files Browse the repository at this point in the history
* ...

* Update README.md

* Update README_CH.md

* Update README_CH.md

* Update README.md

* Small loop

* oops

* Eat my word, taste bad.

* upload the screenshot

* Eat my word..... Taste nice!

* cut off some tr sp

* sorry

* Ate my word

* Delete littlewhitecloudversion.py

* Update tkterm.py

* Update

* More easier to determine the platform with out complex if else

* not default

* autohide will no longer default

* update document

* rename hi to historyindex

* com img

* wrong path s

* s w p

* comp image

* fix #37 & #38 and a small tweak

I am gotta leave now, here you go @Moosems

* Update example_ch.py

* black, isort and small documents

* black, isort and doc

* Pep8?

* Forgot this

* bump version

* Update README.md

* fix #41

* fix #40

* Update README_CH.md

* Update tkterm.py

* fix typo

* a better way to improve it

* del  usele

* small update

* also small updates

* style...?

* also import styles

* emm

* rm CREATE_N?EW_CONSOLE

* Update tkterm.py

* make you happy :)

* fix a lot

* black isort ruff merge variable name

* type ann and isort

---------

Co-authored-by: Moosems <95927277+Moosems@users.noreply.github.com>
  • Loading branch information
littlewhitecloud and Moosems authored Jun 27, 2023
1 parent 4427c98 commit bde10a3
Show file tree
Hide file tree
Showing 12 changed files with 224 additions and 85 deletions.
4 changes: 2 additions & 2 deletions .editorconfig
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ charset = utf-8
insert_final_newline = true

# Special file
[tktermwidget/term.py]
[tktermwidget/tkterm.py]
indent_style = space
indent_size = 4
end_of_line = lf
Expand All @@ -17,4 +17,4 @@ indent_style = space
indent_size = 4
end_of_line = lf
trim_trailing_whitespace = true
max_line_length = 88
max_line_length = 80
4 changes: 2 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
info.txt
.dist/
dist/
tkterm.egg-info/
tkterm/__pycache__/
tktermwidget.egg-info/
tktermwidget/__pycache__/
.DS_Store
.ruff_cache/
32 changes: 25 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,15 +1,37 @@
<h1 align="center"> TkTerminal </h1>
A terminal emulator written in Python using tkinter

#### 🌏 [简体中文](README_CH.md)
[![PyPI](https://img.shields.io/pypi/v/tktermwidget)](https://pypi.org/project/tktermwidget)
![Platform](https://img.shields.io/powershellgallery/p/Pester?color=blue)

## Views:
### 🌏 [简体中文](README_CH.md)

```TkTerminal``` is a terminal emulator written in Python using tkinter. It is quite easy to use.
### Windows
<img src="images/windows.png" width="75%" align="center">

### MacOS
<img src="images/macos.png" width="85%" align="center">

## Features
- User can set the terminal widget with their own options
- Use \ to make new lines (On Windows it is &&)
- Command history recorder
- Styles
- And some on

## Future ideas
- Highlight

## Styles
```tkterminalwidget``` also have some styles to use such as ```Powershell``` ```Command```:
![image](https://github.com/littlewhitecloud/TkTerminal/assets/71159641/3affd018-0408-4e91-96de-4775937e0ab8)


## Installation:
```batch
pip install tktermwidget
```

## Example:
```python
from tkinter import Tk
Expand Down Expand Up @@ -53,7 +75,3 @@ root.deiconify()
root.mainloop()
```

## Install:
```batch
pip install tktermwidget
```
31 changes: 25 additions & 6 deletions README_CH.md
Original file line number Diff line number Diff line change
@@ -1,13 +1,35 @@
<h1 align="center"> TkTerminal </h1>
使用 tkinter 用 Python 编写的终端模拟器

## 截图:
[![PyPI](https://img.shields.io/pypi/v/tktermwidget)](https://pypi.org/project/tktermwidget)
![Platform](https://img.shields.io/powershellgallery/p/Pester?color=blue)

```TkTermianl``` 是一个使用 tkinter 用 Python 编写的终端模拟器

### Windows
<img src="images/windows.png" width="75%" align="center">

### MacOS
<img src="images/macos.png" width="85%" align="center">

## 特征
- 用户可以使用他们自己的观点来设置终端控件,就像文本控件一样
- 用 \ 来输入新行 (Windows上是&&)
- 命令历史记录
- 风格
- 等等

## 未来想法
- 语法高亮

## 风格
```tkterminalwidget``` 也有一些主题可以用 比如 ```Powershell``` ```Command```
![image](https://github.com/littlewhitecloud/TkTerminal/assets/71159641/b1f7cfec-c5e7-48a0-be40-0c0f63fb959b)

## 安装:
```batch
pip install tktermwidget
```

## 样例:
```python
# -*- coding: gbk -*-
Expand Down Expand Up @@ -52,7 +74,4 @@ root.deiconify()
root.mainloop()
```

## 安装:
```batch
pip install tktermwidget
```

1 change: 1 addition & 0 deletions examples/example.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
"""An example for tktermwidget"""
from tkinter import Tk

from tktermwidget import Terminal
Expand Down
2 changes: 1 addition & 1 deletion examples/example_ch.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# -*- coding: gbk -*-
"""An example for tktermwidget"""
from tkinter import Tk

from tktermwidget import Terminal
Expand Down
Binary file modified images/macos.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified images/windows.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
3 changes: 2 additions & 1 deletion setup.py
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
"""Setup for tktermwidget"""
from distutils.core import setup

with open("README.md", "r") as file:
long_description = file.read()

setup(
name="tktermwidget",
version="0.0.3",
version="0.0.4",
description="A terminal emulator for Tkinter",
long_description=long_description,
long_description_content_type="text/markdown",
Expand Down
2 changes: 2 additions & 0 deletions tktermwidget/__init__.py
Original file line number Diff line number Diff line change
@@ -1 +1,3 @@
"""Tktermwidget package"""
from .style import Command, Defaulf, Powershell # noqa: F401
from .tkterm import Terminal # noqa: F401
27 changes: 27 additions & 0 deletions tktermwidget/style.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
"""Styles for terminal"""

Default: dict = { # Style for normal tkterminalwidget
"background": "#2B2B2B",
"insertbackground": "#DCDCDC",
"selectbackground": "#b4b3b3",
"selectforeground": "#e6e6e6",
"foreground": "#cccccc",
}

Powershell: dict = { # Style for powershell
"background": "#012456",
"insertbackground": "#eeedf0",
"selectbackground": "#fedba9",
"selectforeground": "#11120f",
"foreground": "#cccccc",
}

Command: dict = { # Style for normal "cmd.exe"
"background": "#000000",
"insertbackground": "#f2f2f2",
"selectbackground": "#f3f3f3",
"selectforeground": "#000000",
"foreground": "#f2f2f2",
}

# TODO: add a user custom style function later...
Loading

0 comments on commit bde10a3

Please sign in to comment.