标签: button

在Unity 3D中更改按钮图像

我是Unity议员,所以请不要因为这个问题而开除我。

我正在尝试将一个简单的UI按钮更改为类似于“播放”按钮(通过简单的“播放PNG”图像),我看到“按钮” Source Image在“图像”脚本下有一个,但据我所知,我必须选择一个Sprite。

如何从PNG图片创建Sprite?

image button unity-game-engine

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

悬停并按下javafx

我按下按钮写了这个css代码

  .button:pressed {
        -fx-scale-y: 0.9;
        -fx-scale-x: 0.9;
}
Run Code Online (Sandbox Code Playgroud)

这个按钮悬停

 .button:hover {
        -fx-background-color: #383838;
        -fx-scale-y: 1.1;
}
Run Code Online (Sandbox Code Playgroud)

并且它没有按比例缩小,因为要点击按钮,它显然必须悬停.有没有办法在按下按钮时取消悬停代码?

css javafx pressed button hover

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

改变颜色actionButton Shiny R

我试图想办法让一个actionButton来改变颜色(也可能是其他样式元素.)目标是非常通用的,我将在复杂的shineDashboard应用程序中使用它来进行许多按钮响应.简单地说:如果单击一个按钮,或者一个特定元素(即inputlider)发生了与按钮相关联的更改,该按钮应该会改变颜色.

我通常在Shiny中编码我的按钮,如下所示:

  actionButton(inputId= "RunFullModel", label =icon("tree-deciduous", lib = "glyphicon"), 
                       style = "color: white; 
                       background-color: #35e51d; 
                       position: relative; 
                       left: 3%;
                       height: 35px;
                       width: 35px;
                       text-align:center;
                       text-indent: -2px;
                       border-radius: 6px;
                       border-width: 2px")),
Run Code Online (Sandbox Code Playgroud)

我一直在浏览我的屁股,但没有运气的东西有效.我一直在看@Dean Attali的shinyjs来做这件事,但我只能让它改变印刷文本的背景,如下例所示.使用ToggleClass或AddClass的部分似乎不适用于actionButton("x","y").我也尝试使用闪亮包本身的updateActionButton,但这似乎不允许将style ="..."包含在命令中.

library(shiny)
library(shinyjs)
library(shinyBs)
if (interactive()) {
  shinyApp(
    ui = fluidPage(
      useShinyjs(),
      inlineCSS(list(.red = "background: red")),
      inlineCSS(list(.blue = "style = 'background-color: blue'")),
      actionButton("checkbox", "Make it red"),
      bsButton("checkbox2", "Make me blue"),
      p(id = "element", "Watch what happens to me")
    ),
    server = function(input, output) {
      observe({
        toggleClass(id = "element", …
Run Code Online (Sandbox Code Playgroud)

r colors click button shiny

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

在本机中获取onPress按钮的名称

我有两个按钮,它们都调用相同的onPress功能.在回调中,我希望能够区分哪个被按下.

<MKRadioButton
   title='A' 
   group={this.radioGroup}
   onPress={this._toggle}
 />

<MKRadioButton
   title='B' 
   group={this.radioGroup}
   onPress={this._toggle}
 />
Run Code Online (Sandbox Code Playgroud)

然后是电话

_toggle(event) {
    //what should go here to figure out if title A or B was called?
}
Run Code Online (Sandbox Code Playgroud)

button react-native onpress

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

在Telegram Bot中创建一个内联键盘按钮,指向一个URL C#

我还没有使用内联键盘按钮,我想实现它而不是发送链接点击,我想制作一个内联键盘按钮,当用户按下按钮它应该自动指向他给出的URL.

c# api button telegram telegram-bot

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

按下Tkinter等待直到按钮

我有一个游戏,当一个按钮被创建时,我需要我的程序只显示这个屏幕,直到他们按下"下一级"所有这些代码都在一个while循环中,所以在一个大的while循环控制游戏.

......

if game.playerDistance >= game.lowerBound() and game.playerDistance <= game.upperBound():
        game.level += 1

        showLevelResults(game)

        #NextLevelButton
        btnNextLevel = Button(root,
                    #Random Config
                    command = nextLevel,
                    )
        btnNextLevel.place(x=1003, y=492, anchor=NW,  width=247, height=78)

        updateMainScreen()

        while nextLev == False:
            #What Do I put in here to force a wait
    else:
Run Code Online (Sandbox Code Playgroud)

......

nextLev = False
def nextLevel():
    nextLev = True
Run Code Online (Sandbox Code Playgroud)

...

目前这使它保持在while循环中并且当按下按钮时没有任何变化我使用time.sleep(1)来保持等待并且还打印等待btn按下,但是这会使控制台发出警告并且当按下按钮时仍然没有改变屏幕.

def showGameSurvival():

game = gamemode_normal()

while game.health != 0:
    game.next = False 
    clearScreen()
    changeBackground("Survival")

    #Placing Labels on the screen for game.....

    #... Health
    root.update() …
Run Code Online (Sandbox Code Playgroud)

python user-interface tkinter button python-3.x

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

单击时禁用按钮,然后重新启用它

我通过构建一个只有两个按钮True和False的简单测验应用程序开始Android开发.该应用程序显示一个Toast,说明答案是正确还是不正确.
我要做的是在点击/点击后立即禁用这两个按钮,然后在显示Toast后重新启用它们.这是我在我的监听器中尝试按钮的方法:

mFalseButton.setOnClickListener(new View.OnClickListener(){

        @Override
        public void onClick(View v){
            mTrueButton.setEnabled(false);
            mFalseButton.setEnabled(false);

            checkAnswer(false); //Display the appropriate Toast

            mTrueButton.setEnabled(true);
            mFalseButton.setEnabled(true);
        }
    });
Run Code Online (Sandbox Code Playgroud)

这不起作用.单击/点击时,我的按钮永远不会被禁用.我该怎么做才能正确?任何帮助将受到高度赞赏.

java android button

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

javafx-根据布尔值绑定按钮

在这里,我想根据布尔值禁用和启用按钮。

boolean result=(txtItem.getText().isEmpty() && txtQty.getText().isEmpty());

btnOrder.disableProperty().bind(xxxxx);
Run Code Online (Sandbox Code Playgroud)

我应该在那里输入什么?

boolean bind javafx button disabled-input

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

C#如何将不同按钮的按钮文本设置为同一文本框

我有几个按钮和一个文本框.我想这样做,当我按下按钮1时,文本框中的文本转到按钮,当我按下按钮2时,文本转到按钮2,依此类推.我现在有这个:

protected void Button1_Click(object sender, EventArgs e)
    {

        Button1.Text = TextBox1.Text;
    }

    protected void Button2_Click(object sender, EventArgs e)
    {
        Button2.Text = TextBox1.Text;
    }

    protected void Button3_Click(object sender, EventArgs e)
    {
        Button3.Text = TextBox1.Text;
    }
Run Code Online (Sandbox Code Playgroud)

编辑:有没有更短的方法来做到这一点?

c# asp.net textbox button

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

使用样式化组件的React Native中的动态样式按钮

Button组件通常由包含TouchableHighlight(或其他可触摸)的Text元素组成.我正在尝试创建一个使用样式组件设置样式的Button组件,但我无法让我的样式动态响应道具.

按钮组件

下面,我创建了一个类似于基于样式组件文档中的道具示例的Adapting的Button组件.

import React from 'react';
import { Text, TouchableHighlight } from 'react-native';
import styled from 'styled-components/native';

const colors = {
    accent: '#911',
    highlight: '#D22',
    contrast: '#FFF',
}

const Label = styled.Text`
  color: ${props => !props.outline ? colors.contrast : colors.accent};
  font-weight: 700;
  align-self: center;
  padding: 10px;
`

const ButtonContainer = styled.TouchableHighlight`
  background-color: ${props => props.outline ? colors.contrast : colors.accent};
  width: 80%;
  margin-top: 5px;
  border-color: ${colors.accent};
  border-width: 2px;
`

const Button = (props) => …
Run Code Online (Sandbox Code Playgroud)

button react-native styled-components

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