标签: simpledialog

如何调整 tkinter 中 simpledialog.askstring 弹出窗口的大小?

虽然使用 simplesialog.askstring 很好,但我想调整弹出窗口的大小并调整文本输入的宽度。

(示例代码)

from tkinter import *
from tkinter import simpledialog

prompts = ["name", "age", "height", "wheight"]

root = Tk()

for p in prompts:
    answer = simpledialog.askstring(p, root)
    print(answer)
Run Code Online (Sandbox Code Playgroud)

我查看了不同的文档,但似乎无法找到如何做到这一点。

python tkinter simpledialog

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

错误的对话框"Uncaught TypeError:无法读取未定义的属性'sdIntContent'"

我有一个对话框,我在我的所有内部页面中使用它在主页上正常工作但是当第1页开始时我得到一个错误,表示未捕获的TypeError:无法读取未定义的属性'sdIntContent'并且对话框不再出现

<!DOCTYPE html>
<html>
<head>
<meta charset="ISO-8859-1">
<title>Insert title here</title>
<script type="text/javascript" src="http://code.jquery.com/jquery-1.8.3.js"></script>
<link rel="stylesheet" href="http://code.jquery.com/mobile/1.3.1/jquery.mobile-1.3.1.min.css">
<script src="http://code.jquery.com/mobile/1.3.1/jquery.mobile-1.3.1.min.js"></script>
<link rel="stylesheet" type="text/css" href="http://dev.jtsage.com/cdn/simpledialog/latest/jquery.mobile.simpledialog.min.css">
<script type="text/javascript" src="http://dev.jtsage.com/cdn/simpledialog/latest/jquery.mobile.simpledialog2.js"></script>
<link rel="stylesheet" type="text/css" href="http://code.jquery.com/mobile/1.2.0/jquery.mobile-1.2.0.css"> 
<script type="text/javascript">//<![CDATA[ 
$(document).on('pageinit', '#home', function(){ 
    $(document).on ('click','#firstbutton', function () {        
        $('#footerdialog').simpledialog2({themeDialog: 'c'});
    });
    $(document).on('click','#first',function () {
        window.location.href = "#first";
        $('#footerdialog').simpledialog2('close');
    }); 
    $(document).on('click','#second',function () {
        window.location.href = "#second";
        $('#footerdialog').simpledialog2('close');
    }); 
});//]]>  

</script>
<!--script type="text/javascript">//<![CDATA[ 
$(document).on('pageinit', '#home', function(){ 
    $(document).on ('click','#secondbutton', function () {        
        $.mobile.changePage('#secondpage', {
            transition: 'slideup',
            changeHash: true,
            role: 'dialog'
        });
    }); …
Run Code Online (Sandbox Code Playgroud)

javascript jquery jquery-mobile simpledialog

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

tkinter Askstring 在其可见性更改之前被删除

我正在尝试制作一个弹出窗口,人们可以在其中填写输入框中的字符串。我已经经历了很多例子,但它不起作用。

我正在尝试这样做:

    var_entry = simpledialog.askstring("Test", "Test")
Run Code Online (Sandbox Code Playgroud)

我收到此错误消息:

_tkinter.TclError: window ".!_querystring" was deleted before its visibility changed
Run Code Online (Sandbox Code Playgroud)

提前致谢!

编辑:发布错误的错误消息

string tkinter python-3.x simpledialog tkinter-entry

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

Tkinter simpledialog 框在使用 Python3 的 Windows 10 中没有获得焦点

在下面的代码中,第一个对话框立即获得焦点,因此用户只需键入答案并按 Enter。在第二个中,在 Windows 中运行时似乎不会发生这种情况。运行 Raspbian 9,两个窗口在打开时都会获得焦点。

有什么办法可以让两个窗口在 Windows 中打开时都获得焦点?

import tkinter as tk
from tkinter import simpledialog

root = tk.Tk()
root.withdraw()

answer1 = simpledialog.askstring("Test1","This one gets focus when it opens",parent=root)
answer2 = simpledialog.askstring("Test2","This one doesn't",parent=root)
Run Code Online (Sandbox Code Playgroud)

python tkinter simpledialog

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

选择一个选项后如何在flutter中关闭SimpleDialog

我添加了SimpleDialog2 个选项:失物招领。每当我做出选择并被重定向到我想要的位置时,SimpleDialog 不会关闭并停留在我的屏幕上。

开关:

switch (
  await showDialog(
    context: context,
    child: new SimpleDialog(
      title: new Text("Which category?"),
      children: <Widget>[
        new SimpleDialogOption(child: new Text("Found"),
          onPressed: () {
            goToCreate();
          },
        ),
        new SimpleDialogOption(child: new Text("Lost"),
          onPressed: () {
            //Whatever
          },
        ),
      ],
    )
  )
)
Run Code Online (Sandbox Code Playgroud)

和案例:

{
  case "Found":
    goToCreate();
    break;
  case "Lost":
    //Whatever
    break;
}
Run Code Online (Sandbox Code Playgroud)

android simpledialog flutter

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

SimpleDialog Flutter 中的 Snackbar

在我的 Simpledialog 中向按下的方法添加快餐栏时,我遇到了下面的错误代码。[Scaffold.of() 在不包含 Scaffold 的上下文中调用。]

我想就如何提供正确的上下文来解决它寻求您的建议。

import 'package:flutter/material.dart';



void main() {
  runApp(new MaterialApp(home: new AlertApp()));
}

class AlertApp extends StatefulWidget {
  @override
  _AlertAppState createState() => _AlertAppState();
}

class _AlertAppState extends State<AlertApp> {


  SimpleDialog _simdalog;

  void sDialog(){
    _simdalog = new SimpleDialog(
      title: new Text("Add To Shopping Cart"),
      children: <Widget>[
        new SimpleDialogOption(
          child: new Text("Yes"),
          onPressed: (){
            final snackBar = SnackBar(content: Text('Purchase Successful'));
            Scaffold.of(context).showSnackBar(snackBar);
          },
        ),
        new SimpleDialogOption(
          child: new Text("Close"),
          onPressed:() {Navigator.pop(context);},
        ),
      ],
    );
    showDialog(context: context, builder: (BuildContext context){ …
Run Code Online (Sandbox Code Playgroud)

simpledialog snackbar flutter

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

Navigator.pop 不会关闭 flutter 中的 simpledialog

我正在使用颤振构建 android 应用程序。我在以编程方式关闭简单对话框时遇到问题。

现在我有一个名为 ListVessel 的有状态页面。此页面包含来自数组 otherVessels 的 listTile。
下面是这个页面的代码。

class ListVessel extends StatefulWidget {
  final Function() notifyParent;
  ListVessel({Key key, @required this.notifyParent}) : super(key: key);

  @override
  _ListVesselState createState() => _ListVesselState();
}

class _ListVesselState extends State<ListVessel> {
  @override
  Widget build(BuildContext context) {
      return ListView.separated(
        separatorBuilder: (context, index) => Divider(color: Colors.blueGrey),
        itemCount: otherVessels.length,
        itemBuilder: (context, index) {
          return ListTile(
            title: Text("Name: "+otherVessels[index]["shipName"]),
            onTap: () {
              showDialog (
                  context: context,
                  builder: (_){
                    return otherTap(idx:index);
                  }
              );
            }
          );
        },
      );
    }
  }
} …
Run Code Online (Sandbox Code Playgroud)

android showdialog navigator simpledialog flutter

0
推荐指数
2
解决办法
2460
查看次数