- android - 多次调用 OnPrimaryClipChangedListener
- android - 无法更新 RecyclerView 中的 TextView 字段
- android.database.CursorIndexOutOfBoundsException : Index 0 requested, 光标大小为 0
- android - 使用 AppCompat 时,我们是否需要明确指定其 UI 组件(Spinner、EditText)颜色
python C:\Users\ka-6ren">
对于一个科学实验,我写了一个turtle.py
,它会打开一个 800x480 的窗口并绘制一个缓慢增长的黑点。 turtle.py
以 C:\Users\kaza>python C:\Users\kaza\Desktop\Python_scripts\turtle.py "black" 900 40 1 20 20 10 0 0 30 10
开头在命令中。 black
命令后面的数字是点的参数,用于调节点的生长速度、最大尺寸等参数。
如果我执行 cmd,窗口将打开,并且 turtle.py
开始画画。屏幕尺寸为800x480,因此窗口覆盖全屏。唯一让我烦恼的是菜单栏。通过单击它并选择“取消装饰”,我可以使其消失,但我无法找到启动未装饰窗口的方法。 turtle.py
应该在 12 个树莓派上同时启动,并且不可能运行到每个树莓派并取消装饰窗口。
我已经尝试修改 rc.xml
openbox 但没有任何改变。是否有一个cmd命令可以启动turtle.py
自动在未装饰的窗口中?
最佳答案
标准模块turtle
使用Tk(通过Python中的Tkinter
模块)作为其窗口。当您想要取消装饰 Tk 窗口时,可以使用 Toplevel
类的 overrideredirect
方法。这是在 an answer to a similar question 中建议的。来自 the documentation of Tkinter
:
If called with a
True
argument, this method sets the override redirect flag, which removes all window manager decorations from the window, so that it cannot be moved, resized, iconified, or closed. If called with aFalse
argument, window manager decorations are restored and the override redirect flag is cleared. If called with no argument, it returns the current state of the override redirect flag.Be sure to call the
.update_idletasks()
method (see Section 26, “Universal widget methods”) before setting this flag. If you call it before entering the main loop, your window will be disabled before it ever appears.This method may not work on some Unix and MacOS platforms.
请注意,窗口是 still resizable ,但只是不通过平台的窗口管理器。
访问此方法的快速而肮脏的方法是说
turtle.Screen().getcanvas()._root().overrideredirect(True)
创建窗口之后(以避免需要上述.update_idletasks()
解决方法)。
通常,名称开头的 _
表示不应触摸该成员。然而,根据the documentation of Tkinter
,这是到达根窗口的方法:
To get at the toplevel window that contains a given widget, you can often just refer to the widget’s master. Of course if the widget has been packed inside of a frame, the master won’t represent a toplevel window. To get at the toplevel window that contains an arbitrary widget, you can call the
_root()
method. This method begins with an underscore to denote the fact that this function is part of the implementation, and not an interface to Tk functionality.
关于python - "Undecorate" turtle 窗,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/38912653/
我在使用 may e(fx)clipse 应用程序时遇到问题。我想在应用程序启动时显示启动屏幕。我成功创建了实现 StartupProgressTrackerService 的类,并调用了我的 sta
我一直在尝试 Tornadofx。尝试创建自定义标题栏,这是我目前正在尝试的代码 fun main(args: Array) { launch(args) } class MyApp : Ap
对于一个科学实验,我写了一个turtle.py ,它会打开一个 800x480 的窗口并绘制一个缓慢增长的黑点。 turtle.py以 C:\Users\kaza>python C:\Users\ka
我有大量数据,计算排序键的成本相当高。我想要做的是使用 DSU 模式,我在其中获取行并计算排序键。一个例子: Qty Name Supplier Row 1: 5
当我链接我的 C++ DLL 程序时,我收到以下错误和警告: Severity Code Description Project File Line Suppressi
Python 爱好者喜欢谈论一种称为 DSU 的技术: 假设我想按第三个字段的 int 值对列表进行排序: # Decorate decorated = [(int(item[2]), item) f
我使用 JavaFX 创建了一个没有标题栏的全屏应用程序,但它仅在 Windows 上以全屏模式成功启动。当我在Linux(Ubuntu 19.04 Disco Dingo)上尝试时,如果没有标题栏,
我用 Java 创建了一个未修饰的每像素半透明 JFrame。框架的大小(在下面的屏幕中)是 512x512。到目前为止,我只添加了 3 张图像。我的问题是 Compton 创建的窗口阴影几乎破坏了逐
我正在尝试测试一个组件取消装饰器,但我没有。 例子: import React, { Component } from 'react' import { connect } from 'react-r
我最近更新到了 Angular v9,并在更改日志中定义,不推荐使用未修饰的基类,该基类使用 Angular 功能或由指令或组件扩展。 所以我的应用程序中有很多 mixin 是这样的: 销毁: exp
我正在尝试创建一个不会出现在 Windows 任务栏上且未装饰的舞台(没有边框,也没有关闭/最小化/最大化按钮)。我的最终目标是创建一个会弹出通知窗口的托盘图标应用程序。 与此类似 question我
我是一名优秀的程序员,十分优秀!